[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev checkbox with empty value

From: Klaus Weide
Subject: Re: lynx-dev checkbox with empty value
Date: Tue, 2 May 2000 16:24:20 -0500 (CDT)

On Tue, 2 May 100, Janne Peltonen wrote:

> It seems that Lynx handles checkbox type inputs with an empty ("")
> value attribute as if the value was not given at all. When such a
> checked checkbox is submitted, Lynx sends the string "on" rather than
> an empty string. Netscape and IE don't replace empty values but send
> "on" only if the value attribute wasn't there at all.

HTML 4.01 says

   value = cdata [CA]
          This attribute specifies the initial value of the control.
          It is optional except when the type attribute has the
          value "radio" or "checkbox".


So a missing value attribute would fall under error recovery.

> I browsed the standards but couldn't find anything specifically on
> empty value strings, other than some note that CDATA consists of zero
> or more characters.

Neither could I; so value="" should be treated as any
other value.

> I wonder which behaviour is the correct one as I happen to use some
> forms with <input type=checkbox value="" ...>.
> If this is a bug in Lynx, then this should correct it:

Have you tested this?

> --- HTML.c~     Wed Apr 19 18:57:56 2000
> +++ HTML.c      Mon May  1 09:10:10 2000
> @@ -5181,7 +5181,7 @@
>             /* text+file don't go in here */
>             if ((UseALTasVALUE == TRUE) ||
>                 (present && present[HTML_INPUT_VALUE] &&
> -                value[HTML_INPUT_VALUE] && *value[HTML_INPUT_VALUE])) {
> +                value[HTML_INPUT_VALUE])) {
>                 /*
>                  *  Convert any HTML entities or decimal escaping. - FM
>                  */

I would be more careful, and do this change only for the "checkbox" and
"radio" case.  For other types, empty value strings should already
be properly dealt with.  Something like (untested)

                 /-- BTW: huh??  comment makes no sense.
            /* text+file don't go in here */
            if ((UseALTasVALUE == TRUE) ||
                (present && present[HTML_INPUT_VALUE] &&
                 value[HTML_INPUT_VALUE] &&
                (*value[HTML_INPUT_VALUE] ||
                 (I.type && (!strcasecomp(I.type, "checkbox") ||
                             !strcasecomp(I.type, "radio")))))) {

Yes, that's ugly...

Maybe your version is fine, but it should be tested for all the other
possible "type"s.

Btw for type=submit, lynx uses effectively value="Submit" for
value="" and even for value=" ".  That's not really right either,
it seems.  But lynx needs some non-empty text for making the submit
button selectable.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]