How can i use the submit_tag method (from: actionView::FormTagHelper) to create various submit buttons and chose the right action in accord to the button that i pushed? -- Posted via http://www.ruby-forum.com/.
Ivan Medda wrote:> How can i use the submit_tag method (from: actionView::FormTagHelper) > to create various submit buttons and chose the right action in accord to > the button that i pushed?I use javascript and button html tags to do this. <script type="text/javascript"> function postAction(form,action){ form.action="/your_controller/"+action form.submit() } </script> ... <input type="button" value="Action1" onClick="postAction(this.form,''action1'')"/> <input type="button" value="Action2" onClick="postAction(this.form,''action2'')"/> Simo addsw.it -- Posted via http://www.ruby-forum.com/.
OK!
Thanks. I found also another method,if it could interest you:
<%= form_tag (:action => :interfaccia) %>
<%= select_tag (:operator, options_for_select(%w{ ivan bambo ask},
@params[:operator])) %>
<%= submit_tag ("premi") %>
<%= submit_tag ("calca") %>
<%= end_form_tag %>
Ivan.
Simo AD.D.SW wrote:>
> I use javascript and button html tags to do this.
>
>
> <script type="text/javascript">
> function postAction(form,action){
> form.action="/your_controller/"+action
> form.submit()
> }
> </script>
>
> ...
>
> <input type="button" value="Action1"
> onClick="postAction(this.form,''action1'')"/>
> <input type="button" value="Action2"
> onClick="postAction(this.form,''action2'')"/>
>
> Simo
> addsw.it
--
Posted via http://www.ruby-forum.com/.