[html-formfu] how to specify 'label-for' using configuration file for html::formfu

Carl Franks fireartist at gmail.com
Tue Mar 24 11:50:53 GMT 2009


2009/3/24  <kakimoto at tpg.com.au>:
> hi, all,
>
> <form>
>  <label for="male">Male</label>
>  <input type="radio" name="sex" id="male" />
>  <br />
>  <label for="female">Female</label>
>  <input type="radio" name="sex" id="female" />
> </form>
>
> How do we specify the "for" in a form label using html::formfu?
>
> I tried specifying "label   <attribute> " in my config file but it
> doesn't work. Confirmed by checking the generated html.
>
> Here is part of my config file (using Config::General):
>
>   # Address - start
>    <elements>
>        type Block
>        id address
>        <elements>
>           <constraints>
>               max   5
>               type   Length
>               message   Length must be no more than 5 digits
>           </constraints>
>           filter   TrimEdges
>           filter   HTMLEscape
>           name   street_number
>           type   Text
>           label   street_number   <-- This doesn't work.
>           <attributes>
>               title Enter street number here
>           </attributes>
>       </elements>
>
>    # Address - end

Hi,

If the field has an ID, the label will automatically be given an
appropriate 'for' attribute.

An easy way to do this for the whole form is with $form->auto_id()

Carl



More information about the HTML-FormFu mailing list