I have an ad_form (on 4.6.2) that contains a checkbox that has multiple, uh boxes. It looks a little something like this:
set cboxes [list [list don 0] [list talli 1] [list daveb 2]]
ad_form ...
{-section "Vote early, vote often!"}
{cb_admin:text(checkbox),optional {options [list $cboxes]} {label \"Current Admins\"})
...
This renders as I would expect:
Vote early, vote often!
[ ] don [ ] talli [ ] daveb
But what I want to do is pre-check the boxes
set cboxes [list [list george 0] [list pat 1] [list al 2] ]
set values [list 0 1]
ad_form ...
{-section "Your vote counts!"}
{cb_admin:text(checkbox),optional {options [list $cboxes]} {label \"My favorites\"} {values [list $values])
...
And that renders as I would expect.
Your vote counts!
[x] george [x] pat [ ] al
But now, I want to set those multiple checks programatically:
set cboxes [list [list cut_taxes 0] [list abolish_civil_rights 1] [list strategerize 2] ]
set values [list 0 1]
ad_form -name todo...
{-section "Dick Says I Should"}
{tasks:text(checkbox),optional {options [list $cboxes]} {label \"My favorites\"} {values [list $values])
...
I want to check off the boxes programatically, so I try this:
template::element::set_value todo tasks [list 0 1 2]
Basically, I can't get set_value to work at all for multiple selected checkboxes. If you look at the code, it loves putting my arguments in an additional list.
If you peek into the arrays, you can see the result is that my values are nested too deeply into the list.
I believe
template::element::set_value todo tasks 0
would work.
But to set multiple values, I have to do this:
set todo:tasks(values) [list 0 1 2]
That works!
Can someone help out? Is this broekn or is there something else I should be doing?
Thanks!