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

Ashley Pond V ashley.pond.v at gmail.com
Tue Mar 24 22:49:41 GMT 2009


Perhaps related to this. I would like to see the default behavior
mimic that of CGI.pm where the label tags wrap the input elements.
This way there is no "for" necessary to get the same UI behavior of
clicking on the input text to toggle checkboxes and radio buttons. I
believe this is legal XHTML and it's friendlier UI. It changes the
clickable area for input drastically and is much easier on the eyes
and mouse than trying to hit a little 16x16 target.

Carl? I want it enough to do a patch if you think it sounds reasonable
and you're busy.

-Ashley

On Tue, Mar 24, 2009 at 3:24 PM,  <kakimoto at tpg.com.au> wrote:
>
> Re: [html-formfu] how to specify 'label-for' using configuration file
> for html::formfu
>
> Carl Franks
> Tue, 24 Mar 2009 04:51:50 -0700
>
> 2009/3/24  <kakim... 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, Carl,
>
>  thanks but because I want to not touch too much of the form in my
> controller and just want to keep the configuration to the configuration
> file, I will try and specify an "ID" attribute such as:
>
>
>>   # 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
>             id        street_number  <-- I am going to try this out
>>           <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
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>



More information about the HTML-FormFu mailing list