Sorry while doing a cut paste of my code to the mail....i didnt check out ... This is the code which is giving me problems...
function checker() { var choices = 0; var type = confirm("Are you sure you want to preview the Carton Details?"); if (type) { for (counter = 0; counter < cartonquery.cartonselect.length; counter++){ if (cartonquery.cartonselect[counter].checked){ choices = choices + 1; } } if (choices < 1 ) { alert("Please make a selections. \n") return (false); -----Original Message----- From: Karr, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 7:44 PM To: 'Struts Users Mailing List' Subject: RE: Problems with Checkbox > -----Original Message----- > From: Susmita Pati [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 21, 2002 2:26 PM > To: 'Struts Users Mailing List' > Subject: Problems with Checkbox > > > > Hi All > i am doing this check to see if any check boxes have been > selected or not > before the user hits on the submit button. > It works fine if there are more then 1 row displayed on my page..If no > selections have been made then the alert box comes up with > "Please make a > selections." > > But if theres only one row displayed this fails.. > > Any suggestion where am going wrong??? > > function checker() { > var choices = 0; > var type = confirm("Are you sure you want to preview the > Carton Details?"); > if (type) { > for (counter = 0; counter < > cartonquery.cartonselect.length; > counter++){ > if (cartonquery.cartonselect[counter].checked){ > choices = choices + 1; } > } > > if (radio_choices < 1 ) { > alert("Please make a selections. \n") > return (false); You're incrementing the "choices" variable, but referencing the "radio_choices" variable. Run this sort of thing in a javascript debugger and you'll catch these simple errors. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>