Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » SelectionGroup with checkboxes instead of radio buttons

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

Page: 1
Go to End
Author Topic: 1979 Views
  • MarijnKampf
    Avatar
    Community Member
    164 Posts

    SelectionGroup with checkboxes instead of radio buttons Link to this post

    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?

  • zenmonkey
    Avatar
    Community Member
    528 Posts

    Re: SelectionGroup with checkboxes instead of radio buttons Link to this post

    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.

    1979 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.