in reply to RE: Re: How to check value of checkbox on form submit?
in thread How to check value of checkbox on form submit?

However, just setting a value of on in the html and then checking for that value in the script should always work. Whether undefined or null, it definately won't equal the string "on" so...
  • Comment on RE: RE: Re: How to check value of checkbox on form submit?

Replies are listed 'Best First'.
RE: RE: RE: Re: How to check value of checkbox on form submit?
by BBQ (Curate) on May 10, 2000 at 19:21 UTC
    You're right! I thought that sounded a little odd so I ran the following test:
    <html><body> <form action="http://johnny.warp.psi.br/cgi-bin/test.pl"> <input type="text" name="field1"> <input type="checkbox" name="field2" value="on"> <input type="submit"> </form> </body> </html>
    If this form is submitted with everything blank, curiously the text input gets carried as null, but the checkbox is undef! QUERY_STRING : field1=

    I don't see where the consistency is here, but that was something I had never really noticed.