checkbox validation

Results 1 to 3 of 3

Thread: checkbox validation

  1. #1
    minz Guest

    Default checkbox validation

    I have a list of checkboxes with the same name and type but with different values.... ex:<BR>&#060;INPUT type=checkbox name="EmpCB" Value=4&#062; 4Kumar Kothandaraman<BR> <BR> &#060;INPUT type=checkbox name="EmpCB" Value=5&#062; 5Jairam S Kombrabail<BR><BR> &#060;INPUT type=checkbox name="EmpCB" Value=11&#062;11Prabhakara H R<BR> <BR> <BR>How will i retrieve the checked value?????? This is needed for validating this checkbox.....before submitting it to another pg... <BR>document.formname.EmpCB.value is not working.........<BR> <BR>Once i submit this page, i am able to get what ever is checked using request.form.....Pls reply back with the solution as early as possible.... <BR> <BR> <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: checkbox validation

    This is almost identical to the code I just posted for multiple selections in a &#060;SELECT&#062; control:<BR><BR><BR>&#060;SCRIPT Language="JavaScript"&#062;<BR>function getCBvalue( theCBs )<BR>{<BR>&nbsp; &nbsp; var vals = "";<BR>&nbsp; &nbsp; for ( var ix = 0; ix &#060; theCBs.length; ++ix )<BR>&nbsp; &nbsp; {<BR>&nbsp; &nbsp; &nbsp; &nbsp; if ( theCBs[ix].checked ) vals += ( " " + theCBs[ix].value );<BR>&nbsp; &nbsp; }<BR>&nbsp; &nbsp; alert( "The values of the checked checkboxes are: " + vals );<BR>&nbsp; &nbsp; return vals;<BR>}<BR>&#060;/SCRIPT&#062;<BR><BR>And then you invoke that function via:<BR>&nbsp; &nbsp; &nbsp; &nbsp; var whatever = getCBvalue( document.FormName.CheckboxName );<BR><BR>

  3. #3
    minz Guest

    Default Thanks a lot.... Bill

    I thank u for the hourly help<BR><BR>With regards,<BR>Minz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts