2010/12/13 Branko Vukelic <[email protected]>

> Bruno, is there something like {{=authform.children}} to render all
> the interior without the <FORM> tags?


You can get this in this using jQuery notation, web2py has a DOM parser for
HTML tags:
http://web2py.com/book/default/chapter/05#Server-side-DOM-and-Parsing

Look:

create a form
<code>
>>> form = SQLFORM(db.auth_user)
</code>

get elements using css notation
<code>
>>> print form.elements('table')
[<gluon.html.TABLE object at 0x101f83f10>]

>>> print form.elements('table input')
[<gluon.html.INPUT object at 0x101f86310>, <gluon.html.INPUT object at
0x101f86210>, <gluon.html.INPUT object at 0x101c42f10>, <gluon.html.INPUT
object at 0x101f83e90>, <gluon.html.INPUT object at 0x101f83f50>]
>>>

>>> print form.elements('table input #auth_user_email')
[<gluon.html.INPUT object at 0x101c42f10>]
>>>
</code>


or more verbose using indexes:

create a form
<code>
>>> form = SQLFORM(db.auth_user)
</code>

*Print the whole form*
<code>
>>> print form
<form action="" enctype="multipart/form-data" method="post"><table><tr
id="auth_user_first_name__row"><td class="w2p_fl"><label
for="auth_user_first_name" id="auth_user_first_name__label">First name:
</label></td></tr>
......
.......
</table></form>

*print the Inner tags*
</code>
>>> print form.elements()[1]
<table><tr id="auth_user_first_name__row"><td class="w2p_fl"><label
for="auth_user_first_name" id="auth_user_first_name__label">First name:
</label></td></tr>
.....
.....
</table>
>>>




-- 

Bruno Rocha
http://about.me/rochacbruno/bio

Reply via email to