These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Radio button choice hides text field

poregon
Registered: Oct 27 2008
Posts: 80

Hi everyone -

I have a set of 5 radio buttons
Button Group name - Reason
Button 1 name - HealthMine- value is set to 1
Button 2 name - Child - value is set to 2
Button 3 name - Health - value is set to 3
Button 4 name - Exigency - value is set to 4
Button 5 name - ServiceMemberRelative - value is set to 5

I have a DropDownList named DDAffecting that I have set to "invisible"

If someone selects Health, I would like to have DDAffecting become visible, and if they select one of the other 4 buttons, it remains "invisible".

I've done this with a CheckBox before, like this:
Event - Mouse up
if(CheckBox1.rawValue == 1)
{fieldname.presence = "visible"
}
else
{fieldname.presence = "invisible"
}

What is the secret for getting a RadioButton to make the dropdown list visible, and what would be the Event it ties to?

I sure wish I could do something this simple without bothering someone - thanks so much.

poregon

poregon
Salix, Iowa

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Programing, and you are performing programing, requires precise descriptions, correct capitalization, spelling, etc.

For your logical statement being tested, have you tried to change 'CheckBox1'to 'Reason' and the value you want to test for from '1' to '3'?

For the field you are trying to show or hide, have you tried changing the 'fieldnama' to 'DDAffecting'?

// mouse up action for each radio buttonif(Reason.rawValue == 3){DDAffecting.presence = "visible";} else {DDAffecting.presence = "invisible";}

George Kaiser

poregon
Registered: Oct 27 2008
Posts: 80
Thanks so much. That works to make my associated fields visible. From your If statement, I would think that if a different radio button were then selected, the field associated with the first radio button selected would return to "invisible" once a different choice had been made - but they remain visible after selecting a different radio button.
I checked each button's value, and they are all unique, from 1 to 5.

Can you tell me how to make that happen?
If the person filling out the form changes their mind after making a selection and chooses a different radio button (but hasn't yet populated the field associated with it, can I get the associated field that became visible with the first choice return to invisible when a second radio button is selected to replace the first choice?

poregon
Salix, Iowa

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
I test this by placing the scirpt into each of the 5 radio buttons' 'on click'.

Have you read Thom Parker's [link:http://www.acrobatusers.com/tutorials/creating-radio-checkboxes]Creating Radio CheckBoxes[/url] tutorial?

George Kaiser

poregon
Registered: Oct 27 2008
Posts: 80
Sure - I did that - placed this script in each of the radio buttons, each time changing the value in the script to correspond with the button. Each choice brings it's associated field "visible" perfectly - so why don't they return to"invisible" when another of the 5 button is selected?

And thanks for the reference to the Radio Check Boxes article from Thom. I've now read it and have it on my cube wall.

poregon
Salix, Iowa

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
There is also a difference on how the presence property works on a static and a dynamic form. Have you tried your form as a dynamic form?

George Kaiser

poregon
Registered: Oct 27 2008
Posts: 80
Yes. It's been a dynamic form from the start.

poregon
Salix, Iowa

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
It works for me as a version 8 dynamic XML form in LiveCycle Designer preview and Acrobat 8.

George Kaiser

poregon
Registered: Oct 27 2008
Posts: 80
I don't understand - I, to am running Designer 8 with Acrobat 9 Pro Extended. Are you saying that the fields return to "invisible" for you when you select a different button?

poregon
Salix, Iowa

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Yes the field disappears for the dynamic form.

Are sure you want to be running mixed versions and products of Acrobat?

This not recommenced by Adobe and others, there are just too many shared resources between products and versions that can cause problems when the very correct library is not present or replaced by a different version's library with differnt code.

George Kaiser

ggatlanta
Registered: Jun 9 2009
Posts: 2
Hey Poregon,

I too am having the same issue as you. Were you able to find a way to get the fields to revert to invisible upon clicking another radio button?

Thanks,

Graham
xrum
Registered: Feb 25 2009
Posts: 124
can you attach a sample form please. i'll try to help you out
ggatlanta
Registered: Jun 9 2009
Posts: 2
I got it working, thanks anyway.

Graham
hcorbin
Registered: Aug 11 2009
Posts: 57
You can place your script on the change event of the RadioButtonList. The RadioButtonList knows which radio button is selected. This way you maintain one script, not five.

The script will look like so:

form1.#subform[0].Reason::change - (JavaScript, client) if (this.rawValue == 3) {DDAffecting.presence = "visible";}else {DDAffecting.presence = "invisible";}

Cheers,
Hélène