Home
The Toolkit for Online Communities
17095 Community Members, 1 member online, 2182 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Q&A : HTML in formwidget : One Message

Forum OpenACS Q&A: Re: HTML in formwidget

Collapse
2: Re: HTML in formwidget (response to 1)
Posted by Tilmann Singer on
It should be fairly easy to write an html validation for the form builder / ad_form so that you could do formwidget:html(text), but no one has done so yet.

Search in your /api-doc/ for "template::data::validate::" for a list of all datatypes that you can use.

Until someone adds it, you can try to cut the validation block workaround from forums and make it work in your ad_form somehow:

element create message content \
    -label [_ forums.Body] \
    -datatype text \
    -widget textarea \
    -html {rows 20 cols 60 wrap soft} \
    -validate {
        empty {expr ![empty_string_p [string trim $value]]} { [_ forums.lt_Please_enter_a_messag] }
    html { expr {( [string match [set l_html_p [ns_queryget html_p f]] "t"] && [empty_string_p [set v_message [ad_quotehtml [ad_html_security_check $value]]]] ) || [string match $l_html_p "f"] } }
        {}
    }