Skip to main content
Participant
May 4, 2017
Question

How do I make two read-only text fields visible or hidden using radio buttons and also ensure that they will both be hidden when the form is reset?

  • May 4, 2017
  • 1 reply
  • 395 views

I have a form that I would like to flow somewhat like a flow-chart. For example, each question will be answered by a yes or no radio button choice. Depending on the choice, one of two read-only text fields will become visible (either telling the user that they are done or telling them to continue on to the next question). In addition, I would like for both text fields to be hidden in the beginning (and also to become hidden once again when the form is reset and the radio buttons cleared).

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
May 4, 2017

When you clear a form it triggers the validation command of your fields, so you can use that to show/hide the fields in question.

JR Boulay
Community Expert
Community Expert
May 5, 2017

Hi.

@try67 Can you elaborate a little bit more? I'm not sure to understand what you mean.

Thank you.

Acrobate du PDF, InDesigner et Photoshopographe
Participant
May 5, 2017

I found a solution that was pretty quick and easy for me (I'm not a Java writer.). Instead of using radio buttons for the yes/no choices, I decided to use a drop-down list with 3 choices. The starting/default value was "Select" for the first dropdown and left blank for the others. The next two values were "Yes" and "No". Then I went to the Validate tab and told it to Run a custom validation script:. For each drop down item, I wanted to control two text fields and the next drop down field in the list (to also force users to answer the questions in order). I wrote it like this:

if(event.value =="Yes")

{

this.getField("1-4Fam Yes").display = display.visible;

}

else

{

this.getField("1-4Fam Yes").display = display.hidden;

}

if(event.value =="No")

{

this.getField("1-4Fam No").display = display.visible;

this.getField("CRA Dropdown").display = display.visible;

}

else

{

this.getField("1-4Fam No").display = display.hidden;

this.getField("CRA Dropdown").display = display.hidden;

}