Jump to:

10845 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Customizing userforms

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 299 Views
  • jaywhiting
    Avatar
    Community Member
    1 Post

    Customizing userforms Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Customizing userforms Link to this post

    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.

    299 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.