2580 Posts in 695 Topics by 540 members
Data Model Questions
SilverStripe Forums » Data Model Questions » Handle Enum values in FormAction Problem
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 1235 Views |
-
Handle Enum values in FormAction Problem

15 February 2010 at 2:57am
Hi all,
i have some stupid Problem using an Enum field.
static $db = array(
'MultimediaGalerieDummy' => 'Varchar(1)',
'GalerieTyp' => "Enum('Popup, Slider', 'Popup')",
'VorschauTyp' => "Enum('Kompakt, Detail', 'Kompakt')",
);.....
public function doGalerieOptionsForm($data, Form $form) {
/* Werte setzen */
$this->GalerieTyp = $data["GalerieTyp"];
$this->VorschauTyp = $data["VorschauTyp"];$this->write();
$this->doPublish();
....The values become not saved. Why?
-
Re: Handle Enum values in FormAction Problem

15 February 2010 at 12:44pm
Maby you missed some quotation marks:
'GalerieTyp' => "Enum('Popup', 'Slider', 'Popup')",
'VorschauTyp' => "Enum('Kompakt', 'Detail', 'Kompakt') -
Re: Handle Enum values in FormAction Problem

6 August 2010 at 4:00am
Hi,
I disagree I just tried your method baba-papa for an enum that works perfectly well and got an error...
'Sevirty' => "Enum('High,Medium,Low','Medium')",//original
'SevirtyTwo' => "Enum('High','Medium','Low','Medium')",//bab-papa"The default value 'Medium' does not match any item in the enumeration"
(and yes removing 'SevirtyTwo' makes it all work fine)
I'd say your problem is elsewhere, stefant42, maybe you have a onBeforeWrite, validator or something else?
Barry
| 1235 Views | ||
|
Page:
1
|
Go to Top |


