Jump to:

2002 Posts in 1422 Topics by 616 members

Form Questions

SilverStripe Forums » Form Questions » Custom Form Submit Button Not Firing

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

Page: 1
Go to End
Author Topic: 564 Views
  • B00mtastik™
    Avatar
    Community Member
    18 Posts

    Custom Form Submit Button Not Firing Link to this post

    Hey Stripers,

    I created a very simple page type with a form on it. Extension of Page not form. I saw a tutorial and it looked simple enough to reproduce. I got everything to work in the sense that if I called the entire form IE: "$MyCustomForm" in my templates, the entire form shows up and submits to the database I've told it to, and it works well. Including required fields.

    Now, when I loop through the form to get individual fields via $Fields.fieldByName('FirstField') that shows up find as well. I do the same for $Actions and then $Field for actions to get my submit button to show up at the end. I did it this way so I can have find tuned control over what the page itself will look like. And while the template works well, the submit button does not. It doesn't even fire. No error, and in chrome during expect element nothing gets pushed or passed through php either. Its sitting there with class attributes but feels essentially like an empty button.

    Any ideas why this could be happening? That calling the entire form straight works perfectly. But calling each field manually/separately causes the submit button to stop working?

    Thanks in advance.

    -b00mer

    EDIT:

    NOTE: Am using SS 3.0.5 on a Dreamhost Dedicated Server with bootstrap 2.3 (which I will be moving to foundation 4 soon enough)

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: Custom Form Submit Button Not Firing Link to this post

    Javascript validation on the form running when you click submit?

  • B00mtastik™
    Avatar
    Community Member
    18 Posts

    Re: Custom Form Submit Button Not Firing Link to this post

    Hey Willr,

    Nothing would happen at all when clicking submit. As if it was an image. The only that would work was the hover over effect on the button itself.

    I figured out after looking at the html outputs that it might have something to do with the hidden input fields regarding the security token, then confirmed it on the IRC channel when they mentioned the CSRF token check and low and hold it was. It was also me no including the <form> tags along with $FormAttributes, hence the button wasn't being seen.

    All working now with <form $FormAttributes></form> adding to the form area and <% loop HiddenFields %>$Fields<% end_loop %> on the template file.

    Thanks

    -b00mer

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