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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Dropdown causes javascript parse error


Go to End


1765 Views

Avatar
Moose

Community Member, 26 Posts

5 July 2009 at 7:04am

Hi

I have added the following code to a new page type in an otherwise stable CMS project:

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab(
"Root.Content.Behaviour",
new DropdownField(
'memberID',
'Please choose a member',
Dataobject::get("Member")->toDropdownMap("ID", "Surname")
)
);
return $fields;
}

I have also tried adding the dropdown to the Main tab. The db field referred to is defined as

public static $db = array(
'memberID' => 'int'
);

Unfortunately when I now try to Save or Save and Publish i land up with a Javascript Parse Error. I have tried running in dev mode and don't get any errors or warnings before taht point.

Should I report this as a bug or am I doing something dumb?

Thanks