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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

Model admin values for fields not appearing

Go to End



Community Member, 5 Posts

8 June 2009 at 6:19am

I am trying to set the default values for a new record managed by model admin. I've overridden the getCMSAddFormFields in the class Podcast extends DataObject. it works fine for generating the field, but in the ReadonlyField has a value of (none) when the add button is pressed in the model admin.

I'm still new to this, and don't fully understand the distinction between the model code, and the controller code, but I have a feeling that this is solved by a controller... but can extensions of dataobject even have controllers?

Please Help!!

public function getCMSAddFormFields() {
		return new FieldSet(
			new ReadonlyField(
			   $name = "Date",
			   $title = "Select a date",
			   $value = date("d/m/Y")

			new TextField('Name'),
			new TextareaField('Description')