Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Form doesn't run desired action

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

Page: 1
Go to End
Author Topic: 367 Views
  • Elzabar
    Community Member
    2 Posts

    Form doesn't run desired action Link to this post

    I currently have a form which is supposed to edit an existing member when it is run. However when I press submit, rather than running the function, it runs the default action defined in the form which is a non-existant page (www.urlbase.com/profile/ProfileForm). The code is here:


    class ProfilePage extends Page {

    class ProfilePage_Controller extends Page_Controller {
       static $allowed_actions = array(
       public function ProfileForm() {
          $fields = new FieldList(
             new TextField('FirstName', 'First Name'),
             new EmailField('Email', 'E-mail'),
             new CountryDropdownField('Country', 'Location', null, 'NZ')
          $actions = new FieldList(
             new FormAction('SubmitProfile', 'Submit')
          //$validator = new RequiredFields('Name');
          return new Form($this, 'ProfileForm', $fields, $actions);
       public function SubmitProfile($data, $form) {
          $member = currentUser();


    It doesn't seem to recognise the SubmitProfile function... Can anyone tell me what I'm doing wrong here? Thanks in advance

    Edit: *facepalm* Solved it. Was trying to use the currentUser function by itself, had to access the Member class first.

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.