Hi,
I am alway relatively new to SilverStripe and not very used to PHP programming.
I would like to do an ArticleHolder whose behaviour depend on a var (here MyType)
I did the following in the DataObject
<?php
class ArticleHolder extends Page {
private static $allowed_children = array('ArticlePage');
private static $db=array(
'MyType' => "Varchar(10)"
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$typeField = new OptionsetField(
$name = "MyTypeID",
$title = "Type de conteneur",
$source = array(
"1" => "Option 1",
"2" => "Option 2",
"3" => "Option 3",
"4" => "Option 4",
"5" => "Option 5"
)
);
$fields->addFieldToTab('Root.Main',$typeField,'Content');
return $fields;
}
}
class ArticleHolder_Controller extends Page_Controller {
}
Apparently, in the cms I have the right option set, but when I select a value and register, the selection is lost.
What should I do in order for my ArticleHolder to memorize the user's choice ?