Yes. Replace <form action="#" enctype="multipart/form-data" method="post"> <ul> <li>Your name is <input name="name" /></li> <li>Your group is <input name="grp_name" /></li> <li>Your request date is <input name="req_date" /></li> <li>Your email is <input name="email" /></li> </ul> <input type="submit" /> <input type="hidden" name="_formname" value="test" /> </form>
with {{=form.custom.begin}} <ul> <li>Your name is {{=form.custom.widget.name}}</li> ... {{=form.custom.end}} On Friday, 13 December 2013 05:03:34 UTC-6, curly wrote: > > Hello! > > I'm new to web2py and have just started running web2py 2.8.1 in ubuntu > 12.04. > > I am trying to customize the style of SQLFORM in web2py views. Tried to do > this using SQLFORM in HTML. What I have is:- > > model: > db.define_table( > "register", > Field('pi_id',db.pi), > Field('name',requires=[IS_NOT_EMPTY(), IS_ALPHANUMERIC()]), > Field('grp_name'), > Field('req_date','date', requires = IS_DATE(format=('%d-%m-%Y'))), > Field('email',requires=[IS_EMAIL()])) > db.register.grp_name.widget = SQLFORM.widgets.autocomplete( > request, db.pi.name, limitby=(0,10), min_length=1) > > controller: > def display_your_form(): > form = > SQLFORM(db.register,fields=['name','grp_name','req_date','email']) > if form.process(session=None,formname="test").accepted: > response.flash = 'Reg saved.' > redirect(URL('samples', 'default', 'index')) > elif form.errors: > response.flash = 'form has errors' > return dict() > > view: > {{extend 'layout.html'}} > <form action="#" enctype="multipart/form-data" method="post"> > <ul> > <li>Your name is <input name="name" /></li> > <li>Your group is <input name="grp_name" /></li> > <li>Your request date is <input name="req_date" /></li> > <li>Your email is <input name="email" /></li> > </ul> > <input type="submit" /> > <input type="hidden" name="_formname" value="test" /> > </form> > > > Unfortunately, I now no longer get error messages for fields that are left > empty, a date app to help insert a date, and the autocomplete doesn't work > (all of these worked fine with the default view of SQLFORM). Am I missing > something obvious? > > Would custom forms be a better way of doing this? > > Many thanks. > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.