Checkbox Validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ismailc
    New Member
    • Sep 2006
    • 200

    Checkbox Validation

    Hi, I need to validate the value of checkbox to see if the checkbox has been checked.

    I manage to show the value fo checked property
    But cant seem to do an If for validation. Please help

    This shows me True or False of checbox being checked
    Code:
    function Validate()
    {
     testnew=document.getElementById('VE1077Doc').checked;
     alert(testnew);
    }
    But now putting it in an IF for validation does not work
    Code:
    function ValidateInitSubmit()
    {
     if(document.getElementById('VE1077Doc').checked=="false")
     {
       alert("testnewresulkt");
     }
    }
  • ismailc
    New Member
    • Sep 2006
    • 200

    #2
    I can do IF not checked

    Code:
     IF (!document.getElementById('VE1077Doc').checked)
    But this does not work & its part of a longer IF statement so cant use the else
    Code:
     if (document.getElementById('VE1077Doc').checked)
    ?

    Comment

    • RamananKalirajan
      Contributor
      • Mar 2008
      • 608

      #3
      Hi Ismail,
      The true or false you getting in the alert is of type boolean, no need to give double quotes for true and false... just check like this

      Code:
      function ValidateInitSubmit()
      {
        if(document.getElementById('VE1077Doc').checked==false)
        {
          alert("testnewresulkt");
         }
      }
      Thanks and Regards
      Ramanan Kalirajan

      Comment

      • ismailc
        New Member
        • Sep 2006
        • 200

        #4
        Thank You very much this works nicely :)

        Please help on getting Popup Div main window disabled/ghost affect working

        Comment

        • RamananKalirajan
          Contributor
          • Mar 2008
          • 608

          #5
          I have updated that.. Please look into it...

          Thanks and Regards
          Ramanan Kalirajan

          Comment

          Working...