check box if then statement text result

1,322 views
Skip to first unread message

amheng5

unread,
Oct 12, 2011, 1:27:52 PM10/12/11
to Adobe LiveCycle Developers
Hi,

I'm a newbie to the group; however, I've been using Lifecyle for a few
years. My forms have become more complicated and have run into an
issue I wasn't able to find solution on the current discussions but
similar issues

I have checkbox field that when checked should result in text
automatically placed in a text field box. Not sure if this is possible
or if I should be using javascript rather than formcalc

Here's my formcalc:

form1.#subform[0].Table1[1].#subform[1].choicetype::calculate -
(FormCalc, client)
if (CheckBox0==true) then
choicetype0="1st choice"
else
choicetype0="2nd choice"
endif

my script syntax is not validating.

Any suggestions? This is a standalone pdf form that people download,
complete and turn in.

thanks

fred.pantalone

unread,
Oct 12, 2011, 1:51:00 PM10/12/11
to Adobe LiveCycle Developers
You need to reference the "rawValue" node on the fields you are
reading from and assigning values to.

e.g.
choicetype0.rawValue = "1st choice"

Jono Moore

unread,
Oct 12, 2011, 2:10:11 PM10/12/11
to live...@googlegroups.com
Couple of things...

I'd move the logic to the Change event of the checkbox instead of the Calculate event on the text field, it's more efficient as the Calculate events fire every time something changes in the form.

"(CheckBox0==true)" should be "(CheckBox0==1)", that's what's messing you up - and if you put that script on the Checkbox then you can use "$" instead of the name to reference the current object (equivalent to JavaScript's "this"). Then the script would look like:

form1.#subform[0].CheckBox0::change - (FormCalc, client)
if ($==1) then 
choicetype0="1st choice" 
else 
choicetype0="2nd choice" 
endif 

When you test the form in Acrobat you can hit CTRL-J to open the Debugger and it will show you where the error is happening.

You don't need to reference .rawValue in FormCalc.

SnapShot675

unread,
Oct 13, 2011, 8:56:34 AM10/13/11
to Adobe LiveCycle Developers
Another way to do it is to set the On value of the check box to "1st
Choice" and the Off value of the checkbox to "2nd Choice". Then on
the
Change event of the checkbox add this one line:

choicetype0.rawValue = $.rawValue

The .rawValue is actually optional as it is the default property for
FormCalc.

Regards,

Peter LaBelle
Reply all
Reply to author
Forward
0 new messages