Home
The Toolkit for Online Communities
15903 Community Members, 0 members online, 2486 visitors today
Log In Register

Forum OpenACS Development: listbuilder - pre-checking some checkboxes?

OpenACS Home : Forums : OpenACS Development : listbuilder - pre-checking some checkboxes?

Icon of Envelope Request notifications

Hello all,

First: listbuilder rules, thank you.  Being able to produce really NICE looking tables with so little typing is wonderful. :)

Second: A question.  Is there some straightforward way to pre-check some of listbuilder's checkboxes?  I'm pulling rows out of the database and would like to check some of them based on a value pulled from the db.  Feel free to point me at a package that does this already if one exists.  I've looked at the docs (thanks Jade) and api-doc but am not seeing anything that seems to do what I want.

Thanks!

/Cathy

+
Posted by Vinod Kurup on
I know this post is 2 years old, but I just had the same question and found 1 way to do it, so thought I'd post it here for the next wanderer...

First, set -has_checkboxes which tells the listbuilder that you will create your own checkboxes.

Then, in the -elements section, create an element like this:

-elements {
checkbox {
display_template {<input type="checkbox" name="yourlistkey" value="@yourmultirow.yourlistkey@" @yourmultirow.checkbox@ />}
}
...
}
Then, extend your multirow with the 'checkbox' variable.
db_multirow -extend {checkbox} yourmultirow .... {
if { $my_criteria } {
set checkbox "checked"
} else {
set checkbox ""
}
}
Replace yourmultirow with the name of your multirow.
Replace yourlistkey with the listkey column of your list