Basic Select Field Implementation

Silverstripe Version: CMS 4.1.0

Question: How to implement/create a simple select dropdown

Hi there. Very new to SilverStripe. Have been thrown in the deep end and don’t really know what I am doing. I am trying to create a dropdown select on a form.

public function Form(){

        $fields = new FieldList(
            $Store = new SelectField('Store', 'Store', array("1" => "hello", "2" => "Hello2")),

        $actions = new FieldList(
            new FormAction('submit', 'Enquire Now')

        $requiredFields = new RequiredFields(

        return new Form($this, 'Form', $fields, $actions, $requiredFields);

The above code is throwing an error which breaks the site.

I am trying to use the documentation here
But it’s pretty confusing, and I look at it and nothing really tells me anything… and there’s no other examples or anything online!

Any help greatly appreciated.


Can you post the error message?

Turns out there’s a ‘DropDown’ Field… Not sure what ‘SelectField’ would do…

–>> Don’t know how to turn on better errors… I just get a server error.