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

Radio Buttons and fields

Icenor
Registered: Oct 19 2009
Posts: 5
Answered

Hi

I have a 5 radio buttons where the user can only select one of them. Depending on what button he chooses I wish to fill two different fields with two different values. I also want the users to be able to select both fields and write in a value manually without the form automatically reverting to the value of the button selected.

How can I do this when I can only write one default value per radio button?

My Product Information:
Acrobat Standard 9.1.3, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Using one field to populate another field requires scripting. Add a mouse up script to each radio button that writes data into the text fields. If the user types data into the text fields that data will remain stable unless the user clicks on one of the radio buttons.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Icenor
Registered: Oct 19 2009
Posts: 5
Thank you for your answer but I'm at a loss on what code to use. I've really been looking around and I'm unable to find something equal to getField("").value; but for writing into fields.

How do get JavaScript to write to a field when you can't use event.value?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
As long as you are working with an AcroForm, i.e. a form created in Acrobat and not LiveCycle Designer, the "getField().value" is exactly what you want. The "event.value" property is only used to manipulate a Field's own value. And what you are doing is setting a value from another field.

Use code like this

this.getField("TextField1").value = "RadioBut Value 1";

You might want to watch the "Creating your first form" and Form scripting Basics video tutorials at www.pdfscripting.com:

http://www.pdfscripting.com/public/34.cfm#FirstForm
http://www.pdfscripting.com/public/34.cfm#JSIntro

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script