Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » UserDefinedForm - new Action

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 364 Views
  • Silverfish
    Avatar
    Community Member
    59 Posts

    UserDefinedForm - new Action Link to this post

    Hi There,

    i wonder if / how it's possible to add another action than sending an email to an UserDefinedForm (i.e. entering something into a db table).

    Any hints anyone?

    Regards
    S.F.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: UserDefinedForm - new Action Link to this post

    One way you can do that is to add a DataObjectDecorator to the SubmittedForm object and hook into the onBeforeWrite of the submittedform object to write the data to your other table.

  • Silverfish
    Avatar
    Community Member
    59 Posts

    Re: UserDefinedForm - new Action Link to this post

    Hi Willr,

    thx for your answer.

    since I need several different actions (sendig additional mails and more..), an even migth want to define them by the page, I extendend UserDefinedForm and overwrote the process method of it's controller like:

    class FormPage_Controller extends UserDefinedForm_Controller {

    function process($data, $form) {

       if ( $something ) {
          $this->doSomething();
       }
       if ( $somethingElse ) {
          $this->doSomethingElse();
       }

       return parent::process($data, $form);
    }

    This currently seeems to work pretty fine for me.
    Just wanted to mention if someone else is having this prob.

    Regards (and still a happy new year! ;))
    S.F.

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