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.

Customising the CMS /

Can't Save ListBoxField With Multiple Vals?


Go to End
Reply


9 Posts   3169 Views

Avatar
_Vince

Community Member, 162 Posts

6 July 2009 at 1:42pm

Edited: 06/07/2009 1:45pm

Ok, it finally seems to be working! :D

The explode() suggestion was MOSTLY right (or I misunderstood the suggestion, in which case it was COMPLETELY right!)

Trying to set the $value parameter did nothing to change the selected items, which continued to reflect the first value on a comma separated string, no matter what I did.

What I eventually did was this:

function getCMSFields() {
.
.
.

//cast the incoming DB value into an array
      
$this->Kit_Elements = explode(",", $this->Kit_Elements);

$field = new ListboxField('Kit_Elements', "Kit Elements", $source= $productsMap, '', $size=4, '' );

$field->setMultiple(true);

   $fields = parent::getCMSFields();
..
.      
$fields->addFieldToTab("Root.Content.KitElements", $field);
.
.
   return $fields;

}

It DOES seem a tad laborious and just plain weird, but it also seems to be working.

Thanks Will R. for your help and interest! :D

Go to Top