[web2py] How to customize widget rendering in form

2011-08-16 Thread Noel Villamor
I have this for a field definition:

Field('tags','list:reference
tag',widget=SQLFORM.widgets.checkboxes.widget)

I use crud and it renders the field as an html table, as shown below:

table name=tags id=tag_tags class=listtbody
trtdinput type=checkbox value=12 name=tagsbusiness/td/
tr
trtdinput type=checkbox value=11 name=tagsfamily/td/tr
trtdinput type=checkbox value=10 name=tagsfriend/td/tr
/tbody/table

How do I customize the rendering into:

div name=tags id=tag_tags class=list
input type=checkbox value=12 name=tagsbusinessbr /
input type=checkbox value=11 name=tagsfamilybr /
input type=checkbox value=10 name=tagsfriendbr /
/div

Thanks in advance.


Re: [web2py] How to customize widget rendering in form

2011-08-16 Thread Bruno Rocha
insert in any place before the crud creation (model or controller)

crud.settings.formstyle = 'divs'

On Wed, Aug 17, 2011 at 2:15 AM, Noel Villamor noe...@gmail.com wrote:

 I have this for a field definition:

 Field('tags','list:reference
 tag',widget=SQLFORM.widgets.checkboxes.widget)

 I use crud and it renders the field as an html table, as shown below:

 table name=tags id=tag_tags class=listtbody
 trtdinput type=checkbox value=12 name=tagsbusiness/td/
 tr
 trtdinput type=checkbox value=11 name=tagsfamily/td/tr
 trtdinput type=checkbox value=10 name=tagsfriend/td/tr
 /tbody/table

 How do I customize the rendering into:

 div name=tags id=tag_tags class=list
 input type=checkbox value=12 name=tagsbusinessbr /
 input type=checkbox value=11 name=tagsfamilybr /
 input type=checkbox value=10 name=tagsfriendbr /
 /div

 Thanks in advance.




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]