Forum OpenACS Q&A: Response to How to get the form data of a multi-value checkbox?

>ad_page_contract

Well, ad_page_variables is available in OpenACS 3.2 and provides similar functionality, at least for this problem. ad_page_contract provides much greater functionality and is available in OpenACS 4.

>Wouldn't it be easier to just give each checkbox a unique name?

No, it would actually be a bit harder since you would have to write the code contained in ad_page_variables yourself.

What I hear you saying is if you had a list of employees, you would name each of the checkboxes something like emp-<id> (emp-123, etc). The page you were posting to would then look through all the form variables for those which name matched the above pattern and make a list of those id's. This is functionaly equivalent to naming them all emp_id and putting the id in the value of that form variable. But the point is, why not just use the abstraction already available to you? Besides, ad_page_variables provides some nice functionality while encouraging you to document your pages consistently.