Jump to:

5516 Posts in 1734 Topics by 1221 members

Customising the CMS

SilverStripe Forums » Customising the CMS » modify save function

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

Page: 1
Go to End
Author Topic: 1309 Views
  • bebabeba
    Avatar
    Community Member
    192 Posts

    modify save function Link to this post

    Hi!
    I need modify save function: when I save a page in my CMS area, I need add a row in a new table of my db
    Can you explain me where is save function? What's file name? where the exact poin?

    Thanks!

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: modify save function Link to this post

    The cleanest way to do this is to modify the onBeforeWrite (or on after write action of your page). http://doc.silverstripe.org/datamodel#onbeforewrite

  • frankmullenger
    Avatar
    Forum Moderator
    51 Posts

    Re: modify save function Link to this post

    How do you access the data from the form in onBeforeWrite? The form fields are custom and not saved in the record for the Page, but I just want to access the Form data itself and insert some rows into the DB based on that form data.

  • BenWu
    Avatar
    Community Member
    87 Posts

    Re: modify save function Link to this post

    I would like to know as well.

    for now i just use the $_POST to get form values, but it doesn't look like SS way

  • gshegosh81
    Avatar
    Community Member
    10 Posts

    Re: modify save function Link to this post

    $this->record seems to be an array of the stuff from the form in onAfterWrite.

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