tis only with SQLFORM or SQLFORM.factory.

Pass the class to the form

form = FORM(...., _class="helloform")

-Thadeus




On Fri, Nov 27, 2009 at 4:37 PM, Julian Yap <julianok...@gmail.com> wrote:

> When try this in the form:
> {{=form.custom.widget.name}}
>
> I get this error:
> AttributeError: 'FORM' object has no attribute 'custom'
>
> On Nov 27, 5:12 am, Thadeus Burgess <thade...@thadeusb.com> wrote:
> > custom form!!! FTW
> >
> > http://web2py.com/AlterEgo/default/show/205
> >
> > I have that link memorized by now ;)
> >
> > -Thadeus
> >
> > On Fri, Nov 27, 2009 at 4:08 AM, Julian Yap <julianok...@gmail.com>
> wrote:
> > > When using {{=form}} in views, I want to customize the output so it's
> > > more tabular.  Right now, the output all just flows on one line.
> >
> > > Example controller:
> > > def form1():
> > >    form = FORM('Name: ', INPUT(_name='name', value=session.name),
> > >            'To Address: ', INPUT(_name='to_address', requires=IS_EMAIL
> > > ()),
> > >            INPUT(_type='submit'))
> > >    return dict(form=form)
> >
> > > View code:
> > > {{=form}}
> >
> > > Outputs HTML:
> > > <form action="" enctype="multipart/form-data" method="post">Name:
> > > <input name="name" value="Me" type="text">To Address: <input
> > > name="to_address" type="text"><input type="submit"><div
> > > style="display: none;" class="hidden"><input name="_formkey"
> > > value="c15bd62a-fe17-4e3b-a372-aac92f154001" type="hidden"><input
> > > name="_formname" value="default" type="hidden"></div></form>
> >
> > > So I'd like something like this with the benefits of Validation errors
> > > and so forth with line breaks:
> > > <form action="" method="post">
> > > Name: <input name="name" value="Me" type="text"><br>
> > > To Address: <input name="to_address" type="text"><br>
> > > <input type="submit">
> > > </form>
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "web2py-users" group.
> > > To post to this group, send email to web...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com>
> <web2py%2bunsubscr...@googlegroups.com<web2py%252bunsubscr...@googlegroups.com>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/web2py?hl=en.
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to