Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Dropdown causes javascript parse error

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

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

Page: 1
Go to End
Author Topic: 1085 Views
  • Moose
    Avatar
    Community Member
    26 Posts

    Dropdown causes javascript parse error Link to this post

    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

    1085 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.