Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » ListboxField unable to set multiple = true

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

Page: 1
Go to End
Author Topic: 406 Views
  • MartinPhone
    Avatar
    Community Member
    57 Posts

    ListboxField unable to set multiple = true Link to this post

    I'm feeling very stupid but no matter where I look I can't find what I'm doing wrong. I want to display a ListboxField that contains all the values I've specified in my listboxArray array. The values are there alright, I just can't set it to multiple select. I only ever get a one-value dropdownlist...

    I also would like to know how to set the $size to use the size value returned by getAttributes...

    $fields = parent::getCMSFields();
          
          $fields->addFieldToTab("Root.Content.Main", new ListboxField(
              $name = "Treatments",
              $title = "All treatments offered by practitioner",
              $source = $listboxArray,
              $size=8,
              $multiple=true
              )
             );
          return $fields;

    What am I doing wrong?

  • MartinPhone
    Avatar
    Community Member
    57 Posts

    Re: ListboxField unable to set multiple = true Link to this post

    OK to answer my own question I didn't realise value='', would be so important. Put that in and it works.

    My question as to how to set the size to be that of the array still stands though!

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