Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » setFormAction causes error

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

Page: 1
Go to End
Author Topic: 490 Views
  • Fraser
    Community Member
    46 Posts

    setFormAction causes error Link to this post

    I have a signup form:

    function SignupForm() {
          $fields = new FieldSet(
             new TextField("FirstName", "First name"),
             new TextField("Surname"),
             new EmailField("Email", "Email address")
       $submitAction = new FieldSet(new FormAction("SignupAction", "Sign up"));
       $required = new RequiredFields("Email");
          $SignupForm = new Form($this, "SignupForm", $fields, $submitAction, $required);
          return $SignupForm;

       function SignupAction($data, $form) {

          $member = new Member();

          if($group = DataObject::get_one('Group', "ID = $this->defaultGroupID")){


    Which runs fine from the homepage, however it appears on every page and sub page on the site so I need to set the form action.

    I have tried adding this:


    before return $SignupForm and I get the following error when I submit the form (from anywhere)

    Missing argument 2 for Page_Controller::SignupAction()

    function SignupAction($data, $form) {
    70       $member = new Member();
    71       $form->saveInto($member);

    What is going on here?


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.