RadioWidget patch (render items using the LABEL tag)

Bertrand Croq <bertrand.croq-i1BwEb4NmXRWk0Htik3J/[email protected]> Wed, 19 Oct 2005 17:53:51 +0200
Newsgroups gmane.comp.web.zope.formulator.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------060208000901030604090906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Here is a patch that let the RadioWidget items render as follow:

<label for="key_value1"><input type="radio"...>text</label>

Regards,

-- 
Bertrand Croq - FreesKop - Avenue Robert Schuman - 35170 BRUZ
http://www.freeskop.com/ - Tel: 02 99 05 04 56 - Fax: 02 99 05 96 40


--------------060208000901030604090906
Content-Type: text/x-patch;
 name="radio_for.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="radio_for.patch"

? radio_for.patch
Index: Widget.py
===================================================================
RCS file: /cvs/infrae/Formulator/Widget.py,v
retrieving revision 1.49
diff -r1.49 Widget.py
650,655c650,658
<         return render_element('input',
<                               type="radio",
<                               css_class=css_class,
<                               name=key,
<                               value=value,
<                               extra=extra_item) + text
---
>         id = '%s_%s' % (key, value)
>         contents = render_element('input',
>                                   type="radio",
>                                   css_class=css_class,
>                                   name=key,
>                                   value=value,
>                                   id=id,
>                                   extra=extra_item) + text
>         return render_element('label', contents=input, **{'for': id})
658,664c661,670
<         return render_element('input',
<                               type="radio",
<                               css_class=css_class,
<                               name=key,
<                               value=value,
<                               checked=None,
<                               extra=extra_item) + text
---
>         id = '%s_%s' % (key, value)
>         contents = render_element('input',
>                                   type="radio",
>                                   css_class=css_class,
>                                   name=key,
>                                   value=value,
>                                   id=id,
>                                   checked=None,
>                                   extra=extra_item) + text
>         return render_element('label', contents=input, **{'for': id})

--------------060208000901030604090906
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
formulator-dev mailing list
[email protected]
https://infrae.com/mailman/listinfo/formulator-dev

--------------060208000901030604090906--