I am quite new in web2py and trying to show line breaks inside checkbox
labels, but couldn't figure out how to prevent web2py from sanitizing the
tags. My example code is as follows:
in model:
x = [1, 2, 3]
y = ['Apple', 'Banana', 'Cherry']
for i in range(0, len(y)):
y[i] = y[i] + "<br />" + str(x[i])
db.define_table('ex',
Field('exlist', 'list:integer', requires = IS_IN_SET(zip(x, y), multiple
= True),
widget = lambda field, value:
SQLFORM.widgets.checkboxes.widget(field, value, cols = 3))
)
in controller:
def ex():
grid=SQLFORM.grid(db.ex, user_signature=False)
return locals()
in view:
{{extend 'layout.html'}}
<h1>Example table</h1>
{{=grid}}
I tried
http://stackoverflow.com/questions/10578774/modifying-sqlform-text-output-line-breaks-paragraphs-web2py-framework
and
http://stackoverflow.com/questions/9740894/multi-line-headers-with-web2pys-sqlform-grid
but these seem not to work in my situation. Probably I am just missing
something simple, can somebody help?
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.