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

Checked and Uncheck Value for Checkbox

excelgeek
Registered: Nov 3 2007
Posts: 44

HI
I have a checkbox with a export value of 2 and a text field that receives that value when the checkbox is checked. But if the person makes a mistake in selecting that checkbox and unchecks it the value of 2 remains in the text field. I want the value to be 2 when checked and 0 when unchecked. What is the best way to achieve this result? Thank you in advance.

My Product Information:
Acrobat Pro 8.0999999999999996447286321199499070644378662109375, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
There is an order in which events happen witnin Acrobat/Reader. Some are done on a keystroke and many are done on the exit of the field or at other times. All of this is documented in the LiveCycle Designer and Acrobat documents.

If you are updating the text field by using a calculation in the text field, the text field will not be updated until the user exits the check box. You could place the code to update the check box in the "Mouse Up" action and the text field would update upon the release of mouse button.

George Kaiser

excelgeek
Registered: Nov 3 2007
Posts: 44
That sounds perfect. What is the code to update the check box in the "Mouse Up" action. Here is the code I am using the following code:

I have four exclusive Checkboxs across(vcheckbox) and One Checkbox Down(hcheckbox1). They work fine but when you uncheck VAR T1 is should return the value in c1 to Zero it doesn't. It remains with the last value returned.
This script lives in textsub1. Is there something I can add in the script for a null value in the checkbox for when it is unchecked?

var T1 = this.getField("hcheckbox1")
var T2 = this.getField("vcheckbox");
var c1 = this.getField("textsub1");
{
if
(T2.value == 20 & T1.value == 1)
(c1.value = 1);
else

if
(T2.value == 40 & T1.value == 1)
(c1.value = 2);
else

if
(T2.value == 60 & T1.value == 1)
(c1.value = 3);
else

if
(T2.value == 80 & T1.value == 1)
(c1.value = 4);
}