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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

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

Handle Enum values in FormAction Problem

Go to End

3 Posts   2390 Views


Community Member, 14 Posts

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"];


The values become not saved. Why?


Community Member, 279 Posts

15 February 2010 at 12:44pm

Maby you missed some quotation marks:

      'GalerieTyp' => "Enum('Popup', 'Slider', 'Popup')", 
      'VorschauTyp' => "Enum('Kompakt', 'Detail', 'Kompakt')


Forum Moderator, 1899 Posts

6 August 2010 at 4:00am


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?