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.

Archive /

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

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

My custom fields aren't showing up!


Go to End


3 Posts   1750 Views

Avatar
quamsta

Community Member, 29 Posts

9 October 2008 at 10:49am

Edited: 09/10/2008 10:50am

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?

Avatar
Hamish

Community Member, 712 Posts

9 October 2008 at 8:07pm

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

Avatar
quamsta

Community Member, 29 Posts

14 October 2008 at 8:55am

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.