Highlighted

Checkbox Validation Problem

johnqdaily

17-07-2008

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

Replies

Highlighted

pguerett

17-07-2008

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.
Highlighted

johnqdaily

17-07-2008

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
Highlighted

pguerett

17-07-2008

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.