Eoghan schrieb:
> On another topic - you may notice a few other modifications to the
> template above - namely the reordering of CheckBox label elements so
> that they appear after their input element.  My initial expectation
> was that the rendering of the label, errors and help text should be
> delegated to the field widget, rather than being rendered in the form
> - I assume this is in order to accomodate TableForms.

The separation of the the widget, the label and the help & error 
messages also allows to do cool display tricks with DIVs/SPANs and CSS, 
for example CSS-based tooltips for formfields, like I used here (click 
on "Add a comment" and hover over a form field with the mouse):

http://paddyland.serveblog.net/article/29

Here's the template for the form widget:

     <div xmlns:py="http://purl.org/kid/ns#"; id="commentform_wrapper">
       <div id="commentpreview" class="comment"></div>
       <form
         name="${name}"
         action="${action}"
         method="${method}"
         class="fieldsetform"
         py:attrs="form_attrs">
         <div py:for="field in hidden_fields"
           py:replace="field.display(value_for(field), **params_for(field))"
         />

         <fieldset>
           <legend>Add new comment</legend>

           <div py:for="i, field in enumerate(fields)"
             class="${i%2 and 'odd' or 'even'}${error_for(field) and ' 
fielderror' or ''}">
             <label class="fieldlabel" for="${field.field_id}" 
py:content="callable(field.label) and field.label() or field.label" />
             <span py:replace="field.display(value_for(field), 
**params_for(field))" />
             <span py:if="error_for(field)" class="fielderror" 
py:content="error_for(field)" />
             <div py:if="field.help_text" class="fieldhelp">
               <div py:content="field.help_text" />
             </div>
           </div>

         </fieldset>

         <div class="buttonbox">
           <p py:replace="submit.display(submit_text)" />
         </div>
       </form>
     </div>

And the matching CSS is at 
http://paddyland.serveblog.net/static/css/commentform.css.

Chris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to