Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Automatic filling database fields with values

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: 1876 Views
  • Jarek
    Avatar
    Community Member
    30 Posts

    Automatic filling database fields with values Link to this post

    The way to edit additional db table fields in CMS is to overwrite getCMSFields function. I want to fill some fields automaticly and disable them from editing by cms users. How can I make this? I see to solutions:

    1) worse - in getCMSFields fill fields witah values, and disable them from editing in cms
    2) better - catch save action called when button "save & publish" pressed and set fields

    First solutions is quite easy to implement. But I've no idea how make second solution.

    Thx for any help

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Automatic filling database fields with values Link to this post

    this is not hard at all, try with overriding the $defaults array,

    and specify the default values you need there.

    then after that in the getCMSFileds method use headerfields

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