Hello,
thanks for reply. I have tried using params_for but with no luck.
Anyway searching on this group for params_for i found that is
possibile to get help_text and label value using
field_for('my_filed').help_text
field_for('my_field').label
So problem solved :)


On 22 Ago, 08:03, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:
> venomous schrieb:
>
>
>
> > Hello,
> > i have searched a lot but without finding a solution. I have to build
> > some custom forms, but i don't understand how i can get all the
> > paramas for every field.
> > This is an'example code:
>
> > class UsersFields(widgets.WidgetsList):
> >     "basic user fields"
> >     user_name = widgets.TextField(label=_("nickname"),
> > validator=validators.NotEmpty(), help_text="insert your nickname")
> >     email_address = widgets.TextField(label=_("email address"),
> > validator=validators.NotEmpty(), help_text="insert your email
> > address")
>
> > class CuserForm(Form):
> >     template = """
> >     <form xmlns:py="http://purl.org/kid/ns#";
> >         name="${name}"
> >         action="${action}"
> >         method="${method}"
> >         class="tableform"
> >         py:attrs="form_attrs"
>
> >         <table border="0" cellspacing="0" cellpadding="2"
> > py:attrs="table_attrs">
> >         <tr>
> >              ${display_field_for("user_name")}
> >              <span py:if="error_for('user_name')" class="fielderror"
> >                py:content="error_for('user_name')" />
> >             <br />
> >             ${display_field_for("email_address")}
> >              <span py:if="error_for('email_address')"
> > class="fielderror"
> >                py:content="error_for('email_address')" />
> >             <br />
> >             </tr>
> >             <tr>
> >                 <td>&#160;</td>
> >                 <td py:content="submit.display(submit_text)" />
> >             </tr>
> >         </table>
>
> >     </form>
> >     """
> >     params = ["table_attrs"]
> >     params_doc = {'table_attrs' : 'Extra (X)HTML attributes for the
> > Table tag'}
> >     table_attrs = {}
>
> > form_users_register= CuserForm(
> >     fields = UsersFields(),
> >     action = "newUser"
> > )
>
> > so in the class CuserForm how i can access to all the values of
> > user_name?
> > i can only see the field with ${display_field_for("user_name")} and
> > the errors if tere are any with error_for('email_address') but how i
> > can get the label the help_text and other values of the field?
> > Thanks in advance for any help.
>
> Use params_for which should return a dict of parameters of that widget.
> Diez


--~--~---------~--~----~------------~-------~--~----~
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