Thanks Bruno the DIV(FORM()) trick is really nice. Too bad there's no dd, dt, dl which is what I usually use for form layouts. I guess I can always manually append them in.
On Thu, Feb 10, 2011 at 8:32 PM, Bruno Rocha <rochacbr...@gmail.com> wrote: >> Anyone know what properties I can call to get the hidden fields? > > Using SQLFORM you have form.hidden_fields() > but using FORM you need to use Server side DOM and Parsing > ################################################# > # Create a form with hidden elements >>>> form = >>>> FORM(INPUT(_type='hidden',_value='secret'),INPUT(_type='hidden',_value='secret2')) >>>> print form > <form action="" enctype="multipart/form-data" method="post"><input > type="hidden" value="secret" /><input type="hidden" value="secret2" > /></form> > #Get the hidden elements >>>> form.elements(_type='hidden') > [<gluon.html.INPUT object at 0xa35920c>, <gluon.html.INPUT object at > 0xa3592ec>] > #Get by its index >>>> form.elements(_type='hidden')[0] > <gluon.html.INPUT object at 0xa35920c> > # each one >>>> print form.elements(_type='hidden')[0] > <input type="hidden" value="secret" /> >>>> print form.elements(_type='hidden')[1] > <input type="hidden" value="secret2" /> > #iterate >>>> for element in form.elements(_type='hidden'): print element > ... > <input type="hidden" value="secret" /> > <input type="hidden" value="secret2" /> >>>> > ######################################################## >