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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

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

problem with select


Go to End


3 Posts   1103 Views

Avatar
ojalà

Community Member, 87 Posts

17 October 2008 at 2:35am

HI!
I have a problem in creation of select. I follow documentation http://doc.silverstripe.com/doku.php?id=dropdownfield.

I put in Page.php

class MyObject extends DataObject {
static $db = array(
'Country' => "Enum('New Zealand,United States,Germany','New Zealand')"
);
}

under

class Page extend SiteTree{ ..... }

and in the controller of my page

class Page_Controller extend ContentController{

$field = new DropdownField(
'Country',
'Country',
singleton('MyObject')->dbObject('Country')->enumValues()
);
}

but something is wrong, can you help me?

Avatar
Liam

Community Member, 470 Posts

17 October 2008 at 3:16am

Are you trying to use this in the CMS area or on the front end of the site?

You'll just have to adjust where you're putting the actual info.

Avatar
ojalà

Community Member, 87 Posts

17 October 2008 at 3:31am

I want use select from front end of my site,not from CMS..