Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Java script Error help is needed

Java script Error help is needed

Scheduled Pinned Locked Moved ASP.NET
helpjavahtmldebuggingtools
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rameez Raja
    wrote on last edited by
    #1

    Hi all, iam using following java script code for validating multiple checkboxex

    if((document.submitForm.check[0].checked !==true)&&(document.submitForm.check[1].checked!==true))
    {
    alert("Please select the one check box ");
    return false;
    }

    and html page i have declared the checkbox like this.

    <TR>
    <TD align="center">          <input type="checkbox" name="check[]" value="Erosion Control"><font size=3>Erosion Control</font></TD>
    </TR>
    <TR>
    <TD align="center">   <input type="checkbox" name="check[]" value="Forestation"><font size=3>Forestation</font></TD>
    </TR>

    iam getting this error document.check.0. is not object . can any body guide me in this issue that what iam doing wrong . How i debug the java script code ? i have to validate multiple checkboxes Best Regards rameez

    E 1 Reply Last reply
    0
    • R Rameez Raja

      Hi all, iam using following java script code for validating multiple checkboxex

      if((document.submitForm.check[0].checked !==true)&&(document.submitForm.check[1].checked!==true))
      {
      alert("Please select the one check box ");
      return false;
      }

      and html page i have declared the checkbox like this.

      <TR>
      <TD align="center">          <input type="checkbox" name="check[]" value="Erosion Control"><font size=3>Erosion Control</font></TD>
      </TR>
      <TR>
      <TD align="center">   <input type="checkbox" name="check[]" value="Forestation"><font size=3>Forestation</font></TD>
      </TR>

      iam getting this error document.check.0. is not object . can any body guide me in this issue that what iam doing wrong . How i debug the java script code ? i have to validate multiple checkboxes Best Regards rameez

      E Offline
      E Offline
      Elayaraja Sambasivam
      wrote on last edited by
      #2

      Getting all the checkbox object reference use the following script. var getAllcheckbox = document.getElementsByTagName("INPUT"); for(var i=0;i<getallcheckbox.length;i++)> { if(getAllcheckbox[i].type == "checkbox" && getAllcheckbox[i].name = "check[]") { //do your validation here... } }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups