Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Empty TreeMultiselectField and $many_many

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

Page: 1
Go to End
Author Topic: 412 Views
  • hello_world
    Avatar
    Community Member
    17 Posts

    Empty TreeMultiselectField and $many_many Link to this post

    Hi,
    I have defined two classes: Products and Solutions.
    The Product has many Solutions so I defined relationship many_many (static $has_many = array( "Solution" => "Solutions");).
    Just to able add Solutions to Products in getCMSField, I defined TreeMultiselectFiel.

    $MapSolutions = DataObject::get("SiteTree","`ClassName`='Solutions'")->toDropDownMap('ID','Title');   
    $fields->addFieldToTab("Root.Content.Main", new TreeMultiselectField('Solution','Description',$MapSolutions);,'Content');

    During saving relationship are created - works fine. But when I refresh (F5 or CTRL+R) in TreeMultiselectField I can`t see which Solutions will be selected before write Content.

    Thanks for help

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