HTML identities inside form parameters

36 views
Skip to first unread message

Eviatar

unread,
Dec 2, 2011, 1:51:57 AM12/2/11
to we...@googlegroups.com
Hello,

I am new to web.py and have been having issues with websafe escaping characters. I know that when using a form in a template you can do $:form to stop escaping of characters. However, this doesn't work for form parameters.

For example, web.form.Checkbox('<a href="http://www.google.ca/">Hello</a>', id='Testing') does not produce a clickable link, even when using the $: prefix in the template.

Thank you in advance.

Justin Davis

unread,
Dec 6, 2011, 5:25:39 PM12/6/11
to web.py
The first argument in form.Input (Checkbox is such an object) is the
name of the input, which is escaped because it becomes the
'name="foobar"' attribute, and could break your html if it wasn't
escaped. webpy also escapes the "description" attribute, which
defaults to the name value as well. There isn't an obvious way around
what you're looking for unfortunately.

You might have luck playing with the "pre" and "post" attributes,
which do not get escaped. Something like:

web.form.Checkbox('hello', pre='<a href="/">Hello</a>')

Hope that helps!

Cheers,
Justin

Reply all
Reply to author
Forward
0 new messages