Jump to:

10848 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Model admin values for fields not appearing

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 813 Views
  • Matthew
    Avatar
    Community Member
    5 Posts

    Model admin values for fields not appearing Link to this post

    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')

          );
       }

    }

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