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

Java script for check box field

SEVP
Registered: Jul 1 2008
Posts: 9
Answered

Hi,

I have a pdf doc with a set of fields, 3 radio buttons with the same name (Radio button1) with export values 0,1,2 and a Text box field (Text 1)

I want the export value for the radio button selected to transfer to Text1.

I'm not sure how to start with the Java script.
Any help would be greatly appreciated.
thanks!

My Product Information:
Acrobat Pro 8.0, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
In the text field you can add the following "Custom calculation script":

event.value = this.getField("Radio button1").value;if (event.value == "Off") event.value = ''; // do not display "Off" or no radio button checked

Or for each widget of Radio button1 for the "Mouse Up" action:
this.getField("Text 1").value = this.getField(event.traget.name).value;

George Kaiser

SEVP
Registered: Jul 1 2008
Posts: 9
Thank you! that was perfect.
shawn_loc
Registered: Mar 30 2009
Posts: 11
I'm trying to do the same thing but not seeing the results.

I have Radio Check List with three selections

Rad1
Rad2
Rad3

with values of
10
15
1

respectively. I'd like that value to appear in Textbox1 but am not seeing that result with this code.

LiveCycle 8.2.1

Thanks for any help!
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
First, the code presented is for AcroForms or forms created in Acrobat using the "Forms Tools" in Acrobat to create the form fields in a special layer within the PDF and not LiveCycle Designer.

Radios buttons in AcroForms that are given the same name automatically create an exclusionary group, or a group of radio buttons that will only allow one selection.

In LiveCycle Designer you need to access the exclusionary group name as one would in FormCalc without the Acrobat JavaScirpt object references. So if your 3 buttons, "Rad1, "Rad2", and "Rad3", are in the group labeled "RadioButtonList" you only need the following calculation script in the text field:
RadioButtonGroup

George Kaiser