Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

SelectionGroup with checkboxes instead of radio buttons

Go to End

2 Posts   2459 Views


Community Member, 176 Posts

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?


Community Member, 545 Posts

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 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.