Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Applying an if-then statement to check for conditions in multiple checkboxes


Level 2

Thanks for you time and understanding.  Although I have a very basic and generic understanding of writing code, it's not something I am familiar with.  I'm using LiveCycle Designer 8.0 and my problem is this:

I've written some code (FormCalc) that checks to see if a person has:

1.  Not checked one of the checkboxes to ACCEPT or DECLINE the terms and conditions of an agreement

2.  If the person is attempting to make an order, but the DECLINE box is checked

If either of those conditions is true, an error message is generated and the checkboxes are reset.  Below is the FormCalc code:


if (Decline<1 & Accept<1) then

xfa.host.messageBox("You must select to either ACCEPT or DECLINE the terms and conditions before making order selections.")



elseif (Decline>0 & OrderCheckbox1>0) then

xfa.host.messageBox("You cannot make selections because you have DECLINED the terms and conditions.")




(The default for the terms and conditions is to have DECLINE checked)

So when I applied this code to OrderCheckbox1, it worked GREAT!  If neither the ACCEPT nor DECLINE was checked, it came back with an error message and if the DECLINE box was checked, it would give an error message if the person checked OrderCheckbox1 to order that item.  However, there are SIXTY-NINE other checkboxes from which to order and I can't see cutting and pasting this code into all 69.  What if any are the alternatives? 

Oh, why am I using FormCalc?  Because it's simple (albeit primitive) and I haven't the time yet to learn JavaScript.

0 Replies