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?


Reply

9 Posts   2987 Views

Avatar
_Vince

6 July 2009 at 1:42pm (Last edited: 6 July 2009 1:45pm), Community Member, 161 Posts

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