Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Checkbox Validation Problem

johnqdaily
Level 4
Level 4
I have a subform on that has 5 product check boxes in it. The user can check 1 or all of them.



I need to do some sort of validation on all of them so that I can alert the user if at least one not checked. At least one of them has to be checked in order to submit this form.\



Here is the code that I am trying to use:



---------Begin Code--------

if (ckbxDrug1.rawValue == 0 && ckbxDrug2.rawValue == 0 && ckbxDrug3.rawValue == 0 && ckbxDrug4.rawValue == 0)

{

alert("Please choose at least one product!");

}



---------End Code----------



I've tried putting this in several different events of the subform but it hasn't worked.



I have a demo to do tomorrow and need to get this fixed. This is the last of my errors.



Thanks,



John
3 Replies
pguerett
Level 10
Level 10
There is nothing wrong with your logic but you have a scripting error on the message. In acrobat/reader to bring up a message box you need to use app.alert("message goes here") not alert.



Also I woudl put the code on the exit event of the subform that contains the checkboxes.
johnqdaily
Level 4
Level 4
Paul,



Thank you for your help.



I wasn't able to get it to work on the exit event of the subform. Any other thoughts?



Thanks,



John
pguerett
Level 10
Level 10
Post your form to livecycle8@gmail.com and I will have a look. It works on my machine so it must be a configuration issue.