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 /

ListboxField unable to set multiple = true


Reply


2 Posts   469 Views

Avatar
MartinPhone

Community Member, 57 Posts

6 May 2013 at 12:52pm

Edited: 06/05/2013 12:53pm

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?

Avatar
MartinPhone

Community Member, 57 Posts

6 May 2013 at 1:11pm

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!