28 July 2009 at 12:25am
I would like to create a form entry where people can select multiple checkboxes. When one checkbox is selected it should show an additional Textfield. This would be similar to what SelectionGroup does, but rather than using radio boxes it would use a checkbox to allow multiple entries to be selected.
Is there an easy way to achieve this in SilverStripe?
29 August 2009 at 4:28pm
Hmm not sure I'm fully understanding what your trying to achieve. Are the Checkbox's actually saving Data or Just revealing the TextFields.
If its just a matter of revealing fields I would use my standard answer. Use jQuery. Have jQuery, hide the TextFields and Reveal them when the corresponding Checkbox is checked, pluss you can use jQuery to restyle the radio buttons as Checkboxes.
I guess you could also define a new FormFieldType by copying the SelectionGroup.php and SelectionGroup.ss Renaming them and the functions inside and changing the array that contains the HTML to render a checkbox. But I tend to avoid messing around too much in the Core files. Especially when they're cosmetic issues.