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.

All other Modules /

Discuss all other Modules here.

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

Customizing userforms


Go to End


2 Posts   1131 Views

Avatar
jaywhiting

Community Member, 1 Post

17 January 2013 at 11:31pm

I am trying to add a form to userforms using the code below:

<?php

/**
* A dropdown field which allows the user to select a store
*
* @package userforms
*/
class EditableStoreDropdownField extends EditableFormField {

static $singular_name = 'Store Dropdown';

static $plural_name = 'Store Dropdowns';

public function getFormField() {

//$values = Dataobject::get("StorePage", "", "Store ASC");

return new DropdownField(
'Country',
'Country',
array(
'NZ' => 'New Zealand',
'US' => 'United States',
'GEM'=> 'Germany'
)
);

}

public function getIcon() {
return 'userforms/images/editabledropdown.png';
}

}

I've run /dev/build and flush, but whenever I visit a page that I've assigned the field to I get this error:

Please implement a getFormField() on your EditableFormClass.

Even though that method is any there.

Any help would be appreciated.

Avatar
Willr

Forum Moderator, 5523 Posts

24 January 2013 at 8:31pm

Do you see a backtrace? What class is it being triggered from? As you mentioned, it shouldn't be originating in EditableStoreDropdownField so perhaps it's being triggered elsewhere.