Re: INPUT TYPE="checkbox"

On Fri, 24 Aug 2001, Nick Kew wrote:

> > I only found out about this when people with certain web browsers
> > complained that the checkbox didn't work properly (even when they checked
> > it and submitted the form, my server treated them as if they had not
> > checked it).
>
> Now that's another issue, and I'd be in a better position to comment
> if you had cited browser(s) affected and a URL where they exhibited
> the problem.

I didn't give a URL because I already fixed the site by adding the VALUE
attribute to the INPUT tag.

I can't really duplicate this bug, because it was reported by AOL browser
users and I don't have access to that browser. It might even be from an
earlier version of AOL.

> Because my strong prejudice is that a problem is far more likely to
> have been caused by something different, perhaps by a failure in your
> server's processing of the form.

I suspect it is a browser incompatibility issue since I violated the W3C
spec for HTML 4.0, and only those AOL users exhibited a problem.

I just looked at my code again (it's in perl/Apache::ASP), and noticed
something:

for (qw(eml pwd fname lname addr cty stt zp cntry phn option terms login))
{
  $f{$_} = $Request->Form($_);
}

unless ($f{terms} eq 'on') {
  print "ERROR: You must agree to the Terms and Conditions.";
  $Response->End();
}

I'm requiring that "terms" be set to "on". I'm guessing that the AOL
browser decided to send "terms" as something else, since I did not
explicitly specify a VALUE attribute for my checkbox. (Perhaps I should
have just written unless ($f{terms}) instead.)

So, my hunch is that the AOL browser sends a checkbox as something other
than "on" when the VALUE is not specified, which caused my code to break.


This isn't the first time I've ran into trouble with VALUE on checkboxes,
actually. The HTML::FillInForm perl module refused to work properly with
checkboxes that did not have a VALUE set. I asked the author of that
module about it, and he said it was because my HTML was not valid, which I
found hard to believe since validator.w3.org said it was. =) (I think the
author ended up coding a workaround so that VALUE will default to "on" if
it is not specified.)

Received on Friday, 24 August 2001 11:19:40 UTC