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

OR syntax not working

pat_c08
Registered: Sep 17 2007
Posts: 15

I have two checkboxes and at least one of the boxes must be checked in order to pass the edit check but I can't get it to work properly!

If I check at least one of the boxes, the message still appears as if NEITHER box is checked. So it doesn't matter whether I check a box or not the message appears!

The syntax is on a Edit Button that also check for other things which all works. This is the only one that I can't get to work properly!

if ((form1.subPage3.subApply25.ckbQuest26dol.rawValue == 0) || (form1.subPage3.subApply25.ckbQuest26call.rawValue == 0)) {
xfa.host.messageBox("At lease one is required.", "Warning", "1")
exit;
}

Please help and thanks

My Product Information:
LiveCycle Designer, Unix/Linux
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
I believe the syntax for the logical "OR" operator in LiveCycle Designer is "or".

George Kaiser

formman
Registered: Jul 17 2008
Posts: 44
Pat,

In this case you would have to think about all the possible values and test for them:
ckbQuest26dol = 1 AND ckbQuest26call = 0
OR
ckbQuest26dol = 0 AND ckbQuest26call = 1

But I would shorten you code and just add the values of the two checkboxes together and if the sum is less than 1 then throw the message.

I did write the following in Javascript.

//add the values of the two checkboxes.
var oChecked = (CheckBox1.rawValue + CheckBox2.rawValue);

//if the sum is less than 1 throw the message.
if (oChecked < 1)
{
xfa.host.messageBox("At lease one is required.", "Warning", "1");
}

Rick Kuhlmann
Tech-Pro, Inc.

Forms Developer/Designer
Tech-Pro, Inc.
Roseville, MN

pat_c08
Registered: Sep 17 2007
Posts: 15
Hi,

Although I couldn't get the Or, or, nor the || to work I thank gkaiseri for your suggestion. I will continue to work on it for I am sure it is something I am overlooking!

AND, Thanks formman...your way WORKED! I'm happy, my boss is happy, and I am on my way to completing yet another form.

Again, thanks to both for your input. Enjoy your week!

Pat