Add a parameters to submit buttons

21 views
Skip to first unread message

Max Grønlund

unread,
Nov 1, 2014, 3:42:56 PM11/1/14
to plataformate...@googlegroups.com
I'm building a wizard and need a way to detect some user action on submit
E.G

# Submits the form and go to next page in the wizard
<%  = f.button :submit, 'Next', class: 'btn btn-primary', name: "go_to", value: 'next' %>


# Submits the form and go to the show page
<%  = f.button :submit, 'Done', class: 'btn btn-primary', name: "go_to", value: 'show' %>

This don't work


Does anyone know how to detect what button is used for submission in the controller?

Carlos Antonio da Silva

unread,
Dec 28, 2014, 11:32:57 AM12/28/14
to plataformate...@googlegroups.com
Hello Max, have you figured this out?

What gets to the controller is the "name" attribute of the submit button (in case of an input type=submit), so you'd need to give each button a different "name" and detect which one was pressed on the controller, based on the parameter you'll receive.

Hope that helps.

--
You received this message because you are subscribed to the Google Groups "SimpleForm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-simp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
At.
Carlos Antonio
Reply all
Reply to author
Forward
0 new messages