Forum OpenACS Development: Re: Rendering input type checkbox with template::element::create

Hi Iuri

I'm not sure if the forums here have mangled your HTML, or if in fact, that's the problem you're trying to report with your widget!

One thing I noticed about your widget is that I would normally write the -options like this:

-options {{"" "t"}} \

I don't see why you have to escape the double quotes.

Brian

Brian,

Yes, the forum has mangled the HTML I tried to describe.

Basically, what I tried to show here is that depending on the context the ad_proc [template::element::create] changes its behavior for checkbox input type.

I mean, if I call [template::element::create] directly on a .TCL page it works fine. However, if I call it within an ad_proc as in:

ad_proc -public iuri::append_field_to_form { ...} {
...
template::element::create $form_id milestone_p \
-datatype "text" "" \
-widget checkbox \
-label "Miletone" \
-options "{\"\" t}" \
-custom "" \
-html ""
...

the html page in the end doesn't recognize the input element as an html tag and it displays as in

"&lt"input type="checkbox&quot name="release_item_p" value="t&quot id="project_filter:elements:release_item_p:t"""">" "&lt"a href='/intranet-dynfield/attribute-new?attribute%5fid=29046&return%5furl=%2fintranet%2fprojects%2findex%3ffilter%255fadvanced%255fp%3d1%26return%255furl%3d%252fintranet%252fprojects%252f'"&gt"&lt"img src='/intranet/images/navbar_default/wrench.png' border=0 title='' alt=''"&gt""&lt"/a"&gt"

The feeling I had was like a "noquote" was missing as in @tcl_var;noquote@ but [template::element::create] doesn't return anything it just writes the HTM code along the page. *if you know what I mean

I also try to use ad_return_template but it didn't work either.

Any clues?

The forums mangled again and I don't have a way to write

Changes the signs < > " " for its correspondent codes lt; quot; with the & in the bigining

:) hope I could make myself understandable!

Hi Iuri

yes I understand the problem now. I imagine it's a problem of the scope in which you call your proc. My guess is that you are returning the generated HTML in your proc somehow, instead of allowing the form builder to do it for you.

There are plenty of examples already in OpenACS of calling template::element create from a proc. If you're using Project Open, take a look at DynFields; I know it's done there.

best wishes
Brian