[thelist] Netscape 6.1, radiobuttons, and DTD

MRC webmaster at equilon-mrc.com
Fri Mar 1 11:59:04 CST 2002


Lon,

> This makes NO sense to me and further, I don't believe I've ever seen this
> behavior implemented in any browser I've ever used. Do you know of a user
> agent that follows this directive? Is it something that may be implemented

    Lynx. In fact, this very behavior resulted in a list snafu several
months back [1]. Does this behavior make sense? As Martin pointed out, a
group of radio inputs is analogous to a single-select <select> element, and
select elements submit a default value even if the user doesn't explicitly
select a value. So, in that context, at least the behavior is consistent
(though as you say, most UAs don't support this behavior).
    If you want to code to the RFC but don't want to offer the user a
prejudicial or possibly confusing default selection, you can easily use CSS
to do this, e.g.:

<html>
  <head>
    <title>Hide the Default Radio Value</title>
    <style type="text/css">
      .default {
        display: none ;
      }
    </style>
  </head>
  <body>
    <form>
      <input type="radio" name="Radio1" value=""
        class="default" checked="checked"><br class="default">
      <input type="radio" name="Radio1" value="1">One<br>
      <input type="radio" name="Radio1" value="2">Two<br>
      <input type="radio" name="Radio1" value="3">Three<br>
      <input type="submit">
    </form>
  </body>
</html>

    So, the first radio element contains the "checked" attribute, providing
a default value (an empty string in this case) for the group. Most UAs,
which support CSS, will hide both the initial radio element as well as the
following <br> element. Obviously, this is a very rudimentary example that
could be modified and improved.

James Aylard

1. http://lists.evolt.org/archive/Week-of-Mon-20010730/038270.html




More information about the thelist mailing list