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

Check box scripting

Fraser
Registered: Jul 8 2008
Posts: 5
Answered

Hi

I am trying to script a check box so that when selected (ticked ‘On’), it populates other fields in the form.

For example, a user enters their ‘Supply Address’ details at the beginning of the form and later enters in their ‘Billing Address’ details.
If the two addresses are the same I would like the user to be able to tick a check box which would then copy across the 'Supply Address' details to the 'Billing Address' fields. If this is not possible, I would like to get the ‘Billing Address’ fields populated with an instruction like "As per Supply Address".

If anyone can help with Java scripting this action I would really appreciate it.

Thanks,

Fraser

My Product Information:
LiveCycle Designer, Windows
aerokhin
Registered: Jun 27 2008
Posts: 39
Hi!

As you use LCD, you should add following Javascript code on change event of check box. The field names in example are BillingAddress and SupplyAddress. You should change them according to your form design.

if (this.rawValue==1) BillingAddress.rawValue=SupplyAddress.rawValue;


Regards, Andrey.
Fraser
Registered: Jul 8 2008
Posts: 5
Hi Andrey,

Thank you for your response but I am having trouble getting it to work. I have changed the field names to those in my form.

If you or anyone else has any suggestion, I'd appreciate it.

Kind regards,

Fraser
aerokhin
Registered: Jun 27 2008
Posts: 39
What kind of problem do you have?
Check if you choose Javascript as language of the event.
Are there any errors in the Log tab at the bottom of your screen?

Regards, Andrey.
Fraser
Registered: Jul 8 2008
Posts: 5
Hi,

I have chosen Java script. But when I tick the Check box (to equal the value of 1) nothing happens to the relating feilds. I dont get any error messages.

What would be the code for; clicking a check box so that predefined text ("As per Supply Address") is entered into another feild?

Thanks again,

Fraser
aerokhin
Registered: Jun 27 2008
Posts: 39
The code to fill field with predefined text

if (this.rawValue) BillingAddress.rawValue="As per Supply Address";

Just choose your checkbox, open scripteditor, choose change event and Javascript language, and fill in the code.

If you'd like just email me your form and I'll take a look at the problem.
andrey (dot) erokhin (woof) gmail (dot) com

Regards, Andrey.