How do I pass labels to auth forms ?

On Apr 25, 7:55 pm, Anthony <abasta...@gmail.com> wrote:
> If you want to use the default labels specified in the table definition, you
> can manually remove the colons from the labels via the server-side DOM 
> (seehttp://web2py.com/book/default/chapter/05#Server-side-DOM-and-Parsing).
> Specifically, SQLFORM constructs each label as follows:
>
>             label = LABEL(label, colon, _for=field_id,
>                           _id=field_id+SQLFORM.ID_LABEL_SUFFIX)
>
> The colon is the second component of the LABEL element, so you can remove
> all colons as follows:
>
>     form=SQLFORM(db.yourtable)
>     for label in form.elements('label'):
>         label.components = label.components[-2]
>
> Anthony
>
> On Monday, April 25, 2011 10:06:41 AM UTC-4, rochacbruno wrote:
> > On Mon, Apr 25, 2011 at 3:28 AM, Ab... <abhina...@radbox.me> wrote:
>
> >> If there's a workaround other than modifying the core file, I'd like to
> >> know as I'm also facing the same issue.
>
> > You can pass your own labels, and the colon will be removed
>
> > formm = SQLFORM(db.yourtable, labels= dict(field1='My Field', field2='Other
> > Field'), fields=['field1,'field2'])

Reply via email to