Hi there,
How to assign multiple values to an ad_form element -> integer(checkbox) - multiple choices, using TCL script?
More specifically, the ad_form chunk is presented bellow.
ad_form -extend -name annonce -form {
{category_$i:integer(checkbox),optional
{label "<h3>$tree_name</h3>"}
{options $category_options}
The data is inserted in the database as varchar datatype, as in: "1908 1914 1915 1918" .
After retrieving the data, (i.e. "1908 1914 1915 1918") in the -edit_request {} block, I need to assign those ids to each to the checkbox widgets in order to display them as checked.
Briefly, I need to assign multiple values to the checkbox widget. The ad_form element has 10 options and I need to check only the ones retrieved from the DB.
db_1row select_annonce {
SELECT
…
a.category_1
…
EX: The content of category_1 is « 1908 1914 1915 1918 »
I searched for references within OACS source, but I found no such example.
Does anybody have enlightening idea, or another approach, for programming such solution using TCL script?
p.s. I'd like to accomplish "re-using" TCL and ad_form structures, instead of creating a Javascript chunk. Is it possible?
Best wishes,