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

using a check box to populate a field?

astahl
Registered: Jun 8 2007
Posts: 4
Answered

Hi, I'm pretty new to creating forms, so this may be a pretty basic question, but I couldn't find any info about this specific situation...

I'm trying to set up a check box so that it will populate a corresponding field with a specific number (a price) when it is checked; if the user then unchecks the box, the field would ideally become blank again.

In other words, let's say the user checks the box for "Option A", which costs $100. I want "100" to show up in a text field to the right. (There would be many of these check boxes, each with a corresponding field -- the prices in the fields then get added up into a total at the bottom.)

I'm pretty sure I'll have to use some javascript to make this happen, right? Any ideas on how I would do this?

I am using Acrobat 9 Pro to create the form, if that helps.

My Product Information:
Acrobat Pro 9.1.3, Macintosh
StevenD
Registered: Oct 6 2006
Posts: 368
Here is one idea.

This script is placed in a Custom Calculation script in the text field that accepts the value when the check box is checked.

var myVal = getField("YourFieldNameHere");
if(myVal.isBoxChecked(0))
{
this.event.value = "100";
}
else
{
this.event.value = "";
}

The "0" (zero) at the end of the line that says "myVal.isBoxChecked(0)" designates the instance of the checkbox in this case "0" meaning "1".

StevenD

astahl
Registered: Jun 8 2007
Posts: 4
Thanks, Steven! It worked.