i generate sqlform radiobuttons using radiobutton widget below (code trimmed):
db.define_table('taba', field('name', 'string', length=16, required=true, unique=true, ), field('shape', 'string', length=8, default='star', widget=sqlform.widgets.radio.widget, requires=is_in_set({'star' : '<img src="/myapp/static/images/shapes/star1.png" />'})))
my problem image code above gets sanitized , image tag doesn't show up. can turn off sanitization sqlform somehow? or there different elegant solution this? code above shows 1 radiobutton item simplicity, items generated dynamically.
you can replace '<img src="/myapp/static/images/shapes/star1.png" />'
1 of following 2 options:
xml('<img src="/myapp/static/images/shapes/star1.png" />')
img(_src='/myapp/static/images/shapes/star1.png')
also, preferable use url() function generate outgoing urls. replacement, above 2 options change to:
xml('<img src="' + url('static', 'images/shapes/star1.png') + '" />')
img(_src=url('static', 'images/shapes/star1.png'))
for more information, see online book topics on xml() , img helper.
Comments
Post a Comment