Hide fields in webforms untill needed

Hi,

I’ve got several webforms where I would like to hide file fields untill they are needed (that is, when the previous radio button is chosen as ‘Yes’).

At this moment I have a layout rule on a two optioned radiobutton ‘Yes’ and ‘No’ with default value blank. In case the user has not yet selected a radio button, I want the file field to be hidden. If he choses ‘Yes’ it needs to be shown and required, and if the user choses ‘No’ I need it to remain hidden.

I am able to insert rules which cause the field to (dis)appear depending on the ‘Yes’ or ‘No’, but I am unable to change the default of the file field into hidden while keeping the If>Yes rule in place. I’ve tried this with an if>’ ’ then hide field…, but this does not seems to be working when opening the webform using the link (works only after the user changes the value of another field in the webform)

Is there a way to hide a file field untill it is triggered by a layout rule?

Thankyou,

Colin

Hi Colin,

Modify your layout rule as below so that when form loads the rule gets trigger and it will hide/show based on your requirement.

testradio = ‘’ || testradio = ‘No’

Regards,
Mounika

Hi Mounika,

Already tried it. This does not hide my file field by default. It only hides it whenever those rules are executed. I first have to trigger them by assigning a value in any of the fields of the web form. Then it starts to execute the command which you’ve just provided. Rather, I want it to automatically execute it by default upon opening the web form.

Is this possible?

Colin

Hi Colin,

It worked for me with the provided solution. I have two layout rules which will hide the file field on below condition.

  1. testradio=‘Yes’ ||testradio = ‘’
    condition matches
    show–> filefield
    else
    hide–> filefield

  2. testradio=‘No’
    condition matches
    hide–> filefield
    else
    show–> filefield

Hi Mounika,

When trying to introduce the layout rules you provided, I get an error which states that testradio does not exist.

My case field name is ’ sleutels_nodig’. Could you provide me with a correct function?

Thanks,

Colin

Just you need to replace testradio with your field name

  1. sleutels_nodig=‘Yes’ ||sleutels_nodig= ‘’
    condition matches
    show–> filefield
    else
    hide–> filefield

  2. sleutels_nodig=‘No’
    condition matches
    hide–> filefield
    else
    show–> filefield

Current rules:

Layout rule 1: sleutels_nodig = ‘Yes’ --> Show filefield VOG

Layout rule 2: sleutels_nodig= ‘No’ || sleutels_nodig= ‘’ --> Hide filefield VOG

This means that the filefield is showed only if the radiobutton sleutels_nodig is answered with Yes. The rules are executed accordingly whenever the radiobutton is pressed as ‘Yes’ or ‘No’, but whenever it is not filled in, the file field is still shown

See provided screenshot.

Layout rule 1: sleutels_nodig = ‘Yes’ --> Show filefield VOG

Layout rule 2: sleutels_nodig != ‘Yes’ || sleutels_nodig= ‘’ --> Hide filefield VOG

Use above rules. It will work for you.

This seems to be working, partly. Upon running the webform the filefield is shown. However, now, if I assign a value to another radio button in my form, which has no rules in conjunction with sleutels_nodig, it executes the rules as you’ve said.

Which means that whenever click on a radio button, the filefield disappears. A rule must first be initiated by a click on a (random) radiobutton, it does not run on a just opened web form.

How is this possible?