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

Greying out Radio buttons

sammer021486
Registered: Apr 30 2010
Posts: 11

Hello, I am trying to write some script that will allow a form to grey out certain radio buttons.

Below is the layout of the buttons on the form. The buttons outlined in red are the primary options, I would like the buttons outlined in blue to be greyed out unless button #4 is selected. Once it is selected I would like to allow the blue outlined buttons to activate.

[img]http://sphotos.ak.fbcdn.net/hphotos-ak-sjc1/hs351.snc3/29176_385215608299_505568299_3938329_6486260_n.jpg[/img]

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

you need a bit scripting to do this.
This example requires that all radio buttons in the targeted group are named the same (such as "Option").

form1.#subform[0].RadioButtonGroup1::ready:layout - (FormCalc, client)if($.rawValue == 4) thenRadioButtons2.access = "open"RadioButtons2.Option[*].caption.font.fill.color.value = "0,0,0"elseRadioButtons2.access = "nonInteractive"RadioButtons2.Option[*].caption.font.fill.color.value = "130,130,130"endif

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

sammer021486
Registered: Apr 30 2010
Posts: 11
radzmar wrote:
Hi,you need a bit scripting to do this.
This example requires that all radio buttons in the targeted group are named the same (such as "Option").

form1.#subform[0].RadioButtonGroup1::ready:layout - (FormCalc, client)if($.rawValue == 4) thenRadioButtons2.access = "open"RadioButtons2.Option[*].caption.font.fill.color.value = "0,0,0"elseRadioButtons2.access = "nonInteractive"RadioButtons2.Option[*].caption.font.fill.color.value = "130,130,130"endif
I have to apologize as I have no clue where I am suppose to place this code. Am I placing it in the subform's coding or am I placing it on the radio button and what event do I place the code under.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Did you recognized the first line in the code example?
This is where I placed the code (form object, event and script language).
But remember, the reference syntax for the form object may be different in your form.

form1.#subform[0].RadioButtonGroup1::ready:layout - (FormCalc, client)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

sammer021486
Registered: Apr 30 2010
Posts: 11
radzmar wrote:
Did you recognized the first line in the code example?
This is where I placed the code (form object, event and script language).
But remember, the reference syntax for the form object may be different in your form.

form1.#subform[0].RadioButtonGroup1::ready:layout - (FormCalc, client)
When I posted the reply, no I did not recognize the first line of code. After reading some of Adobe's pdfs on how to script in LiveCycle I understand it a little better.

Here is what my headings look like for the code of the buttons

topmostSubform.Page1.Eligibility.#field[0]::mouseDown - (JavaScript, client)
Eligibility is the name of the radio button group.

I am using Livecycle Designer ES 8.2.1.3144.1.471865
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You have to select the radio button group (not a single button of it) and put the script into it's layout ready event in the script editor window.
To get it work you need to change the language in the script editor from JavaScript to FormCalc, too.
So it should look like:
topmostSubform.Page1.Eligibility::ready:layout - (FormCalc, client)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

sammer021486
Registered: Apr 30 2010
Posts: 11
 topmostSubform.Page1.Eligibility[1]::ready:layout - (FormCalc, client)if($.rawValue == 4) thenEligibility[0].access = "open"Eligibility[0].caption.font.fill.color.value = "0,0,0"elseEligibility[0].access = "nonInteractive"Eligibility[0].caption.font.fill.color.value = "130,130,130"endif

I had to remove the [b][i] .Option[*] [/b][/i] for it to work in my test form, but when I use my actual form the second grouping of buttons are not visible. Does this have anything to do with the form being static and not dynamic
sammer021486
Registered: Apr 30 2010
Posts: 11
I had to recreate the form in Live Cycle, so that I could save it as a dynamic form. I am guessing from what I have read that the form would not work because the form was created from a WORD document.

One thing that I would like to add to the group is, if the user selects the #4 radio button and selects the nested radio buttons from group 2 but decides to change their answer how do I clear the 2nd group of radio buttons if #4 is not checked?
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
OK, this is not a great thing.

You can put a script into the layout:ready event of your second radio button group which checks the current value of the first one.

...RadioButtonGroup2::ready:layout - (FormCalc, client)if(RadioButtonGroup1 ne 4) thenRadioButton1 = nullRadioButton2 = nullendif

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs