I've spent a couple of hours googling and rtfm-ing but can't seem to find 
a clean way of doing this.

I have a legacy database with various fields containing known, safe html 
text (e.g. `this & that` and things like apostrophes e.g. `John's 
place`).  I need to use a number of these fields as options in multiple 
select boxes in a form.

Just using {{=XML(form)}} in the view doesn't work since it appears the 
form is preprocessed and it escapes the & in & resulting in raw html 
like `&` being output (which then displays to the user as & 
instead of just the &.

In the controller I use:
 form = SQLFORM.factory(
    Field('regions',        requires=IS_EMPTY_OR(IS_IN_DB(db, 
db.regions.id, '%(region)s', orderby='sort_order', multiple=True))),

Is there a way to tell web2py that the contents of a field, coming from a 
db, are safe prior to it rendering the form so that it does not escape it? 

Thank you,
JC

-- 



Reply via email to