Pass html in label of SQLFORM.factory Field without it by sanitized

24 views
Skip to first unread message

Thomas Sitter

unread,
Jul 15, 2015, 11:09:14 PM7/15/15
to web...@googlegroups.com
Hello,

I am trying to pass HTML from my controller in a SQLFORM.factory but it keeps getting sanitized

form = SQLFORM.factory(
Field('install_consent', 'boolean', 
label='I consent for ____ to provide my contact information to _______. <strong>I confirm that my house DOES NOT have aluminium siding. *</strong>',
requires=IS_NOT_EMPTY('You must provide consent in order to recieve the equipment')
)
)

Is there anyway to do this?

Thanks for the help.

Massimo Di Pierro

unread,
Jul 16, 2015, 3:40:13 AM7/16/15
to web...@googlegroups.com, thomas...@gmail.com
label = XML('I consent for ____ to provide my contact information to _______. <strong>I confirm that my house DOES NOT have aluminium siding. *</strong>')

or

label=SPAN('I consent for ____ to provide my contact information to _______. ', STRONG('I confirm that my house DOES NOT have aluminium siding. *')),

Johann Spies

unread,
Jul 16, 2015, 4:00:21 AM7/16/15
to web...@googlegroups.com
Hello Thomas,

It seems that the css for label anyhow uses a strong font so <strong></strong> would not have any visible effect. This is just to illustrate how you can pass html in a form element:

label=XML('I consent for ____ to provide my contact information to _______. <I>I confirm that my house DOES NOT have aluminium siding. *</I>'),

BTW "receive"  might be better than "receive". :)

Regards.
Johann
--
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

Thomas Sitter

unread,
Jul 16, 2015, 12:00:18 PM7/16/15
to web...@googlegroups.com
XML() worked perfectly (and good catch on 'recieve', I get that wrong every time :P)

Thank you Massimo and Johann for the quick replies.
Reply all
Reply to author
Forward
0 new messages