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

Changing a text box based on a check box

mark4444az
Registered: Nov 17 2011
Posts: 11

Hello,
I am trying to change a text box based on if a check box is checked, here's what I have in the calculate tab of the text box:
 
if (CheckBox53.rawValue == 1)
{
event.value = "Fail!";
}
else
{
event.value = "";
}
 
This does not seem to work, does anyone have any ideas?

My Product Information:
Acrobat 9.0, Windows
mmazal
Registered: Jul 20 2009
Posts: 27
you look to be combining Livecycle terminology with Acroform

do not use rawValue in acroform

livecycle has no idea what event.value means

which one do you want?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
If it's an Acrobat form, just change the first line to:

if (this.getField("CheckBox53").value != "Off")

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

mark4444az
Registered: Nov 17 2011
Posts: 11
This is an Abobe Acrobat pdf file. I'm not sure what Livecycle is to be honest.
Here is what I just tried:

if (getField("CheckBox53").RawValue == 1)

{
event.value = "Fail!";
}
else
{
event.value = "";
}


If it doesn't know what "RawValue" is then I am not sure how to make a determination on the check box.
Thanks very much for your help.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Use the code I provided, without changing it.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

mark4444az
Registered: Nov 17 2011
Posts: 11
Ah, I see. Thanks very much, I am still struggling with the syntax here, just need more practice.
mmazal
Registered: Jul 20 2009
Posts: 27
I find the easiest way is to think about a checkbox as 'Off' or 'Not Off'.
That way the actual value doesn't matter.

if (getField("CheckBox53").value == "Off")
{
event.value = "Fail";
}
else
{
event.value = "";
}
mark4444az
Registered: Nov 17 2011
Posts: 11
I see, that makes sense.
Again, thanks so much for your help.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
This code will have the opposite effect, ie the field will be populated with "Fail" when the check-box is not ticked. I had understood you wanted it filled when the box is ticked...

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

mark4444az
Registered: Nov 17 2011
Posts: 11
Correct.
What I am using:
!= off is working.