John J Lee <[EMAIL PROTECTED]> writes:

> On Tue, 14 Oct 2003, Gisle Aas wrote:
> [...]
> >     HTML::Form's dump now also print alternative value names.
> 
> What does 'alternative value name' mean?  Is this something to do with
> OPTION element contents (<option>this bit</option>) and labels?

Yes.  If a form contains:

    <select name=sex>
      <option value=F> Female
      <option value=M> Male
      <option value=?> Unknown
    </select>

Then the values that this field might take becomes "F", "M" and "?",
while the value names are "Female", "Male" and "Unknown".  With newer
version of HTML::Form you can use both to modify the values.  The
statement

   $form->param(sex => "Male")

and

   $form->param(sex => "M")

have the same effect.

> >     HTML::Form will now pick up the phrase after a <input type=radio>
> >     or <input type=checkbox> and use that as the name of the checked
> >     value.
> [...]
> 
> What does this mean?  Something like this, maybe (no name attributes)?
> 
> <input type=checkbox>foo</input>
> <input type=checkbox>bar</input>

No.  It's the same concept as for the select/option shown above.  If
you have a form containing:

   <input name=sex type=radio value=F> Female
   <input name=sex type=radio value=M> Male
   <input name=sex type=radio value=? checked> Unknown

then the values and value names for the sex field will be the same as
in the previous example and:

   $form->param(sex => "male")

will just work.  That is if you are not surprised by $form->("sex")
returning "M" even if you just set it to "male".

Regards,
Gisle

Reply via email to