Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » My custom fields aren't showing up!

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1214 Views
  • quamsta
    Avatar
    Community Member
    29 Posts

    My custom fields aren't showing up! Link to this post

    I'm kinda pulling my hair out here. I have a page type named StudentsPage.php and the following code within it:

    class StudentsPage extends Page {
    static $db = array(

    'LeftDesc' => 'Text'

    );
    static $has_one = array(

    );
    }

    function getCMSFields() {
       $fields = parent::getCMSFields();
       $fields->addFieldToTab('Root.Content.Main', new TextField('LeftDesc'), 'Content');

    return $fields;
    }

    class StudentsPage_Controller extends Page_Controller {

    }

    But no matter how much I

    ?flush=1

    or

    /db/build?flush=1

    , the text field will not show up in the CMS. Is there something glaringly obvious that I'm missing?

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: My custom fields aren't showing up! Link to this post

    Looks fine here - maybe your browser cache needs to be cleared too?

  • quamsta
    Avatar
    Community Member
    29 Posts

    Re: My custom fields aren't showing up! Link to this post

    Yay! I finally figured it out. My getCMSFields() was not inside the StudentsPage class. Maybe this could be made a bit more clear in the tutorial? I'm not sure if the tutorial explicitly says this or not.

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