Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@apache.org Received: (qmail 29814 invoked from network); 22 Aug 2002 12:25:31 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 22 Aug 2002 12:25:31 -0000 Received: (qmail 16679 invoked by uid 97); 22 Aug 2002 12:25:45 -0000 Delivered-To: qmlist-jakarta-archive-struts-user@jakarta.apache.org Received: (qmail 16663 invoked by uid 97); 22 Aug 2002 12:25:45 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 16651 invoked by uid 98); 22 Aug 2002 12:25:44 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <11D99A07DE66D311A09900E02936227D4A3564@alntexchsvr.alsysinc.com> From: Susmita Pati To: 'Struts Users Mailing List' Subject: RE: Problems with Checkbox Date: Thu, 22 Aug 2002 08:25:51 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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:david.karr@attws.com] Sent: Wednesday, August 21, 2002 7:44 PM To: 'Struts Users Mailing List' Subject: RE: Problems with Checkbox > -----Original Message----- > From: Susmita Pati [mailto:SPati@alsysinc.com] > 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: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: