2011 Posts in 1436 Topics by 620 members
|Go to End|
8 May 2010 at 9:18pm
Say I have a table of tradesmen, and a table of job descriptions ("plumber", "electrician", etc)
I would like to let users search for tradesmen by job description.
Ideally, the form would display all the available job descriptions with a checkbox next to each one, so the users could pick several job descriptions at the same time.
The problem is, I don't know how many job descriptions there will be (there's supposed to be a maximum of 30) and what I would like to do is:
Query the database and get all the available job descriptions
Loop through the records
For each record in the loop, create a checkbox in the form.
Is there any way of doing this?
If it was straightout php I guess I could echo everything onto the page, but I'm not sure how to do this in SilverStripe? Any suggestions?
8 May 2010 at 10:10pm
Yep, check out CheckboxSetField - http://api.silverstripe.org/2.4/forms/fields-basic/CheckboxSetField.html.
8 May 2010 at 11:09pm
Wow, that worked like a charm!
Thank you very much (:
|Go to Top|