Jump to:

2002 Posts in 1422 Topics by 616 members

Form Questions

SilverStripe Forums » Form Questions » CheckboxSetField Defaults not working

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

Page: 1
Go to End
Author Topic: 359 Views
  • Stef87
    Avatar
    Community Member
    66 Posts

    CheckboxSetField Defaults not working Link to this post

    Hi I'm using SilverStripe 2.4.7

    I am generating around 250+ checkboxes, using a DataObjectSet of DataObjects, and want all of them to be checked by default. I tried passing the same array that populates the checkboxsetfield to the setDefaultItems method like so...

    $checkBox->setDefaultItems( $values );


    but that didn't work. I'm completely stumped as I can't find anything else that even hints at how to do this and I'm getting desperate.

    I just keep getting this error.

    in_array() expects parameter 2 to be array, object given

    Thank you.

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