any idea to use 2 submit_tag in a from ,and the action also should be two... like below(absolutely below code will not work ,but i want like that)... <%=start_form_tag %> something here <%=submit_tag "submit1" ,:action=>''action1'' %> <%=submit_tag "submit2" ,:action=>''action2''%> <%=end_form_tag%> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
not sure if that''s the perfect way to do it, but it worked fine for me:
in the onclick of submit_tag set (with prototy.js func in this case) the
forms action and then call submit like this:
<%= submit_tag "Upload Image", :onclick =>
"$(''form_id'').action=''#{article_images_path(article)}'';$(''form_id'').submit();"
%>
replace form_id with id of your form and articles_image_path with
whatever you want to call
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Thorsten Mueller wrote:> <%= submit_tag "Upload Image", :onclick => > "$(''form_id'').action=''#{article_images_path(article)}'';$(''form_id'').submit();" > %> > > replace form_id with id of your form and articles_image_path with > whatever you want to callthank you for quick reply unknown aciton error is occured -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> unknown aciton error is occuredthen please post the code and the error in more detail nobody can know, what''s in your controller and what you call this $(''form_id'').action=''#{article_images_path(article)}'' is only an example, you must replace article_images_path with an url that points to your controller/action as you would use it eg in a link_to -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller wrote:> >> unknown aciton error is occured > > then please post the code and the error in more detail > nobody can know, what''s in your controller and what you call > > this > $(''form_id'').action=''#{article_images_path(article)}'' > is only an example, you must replace article_images_path > with an url that points to your controller/action > as you would use it eg in a link_tothank you for reply actually i don''t know html very well i want to make a form ,which should have 2 submit tag if i click save then it should got to(with all params values) action save if i click update then it should got to(with all params values) action update <%=start_form_tag %> something here <%=submit_tag "Save" ,:action=>''save'' %> <%=submit_tag "Update" ,:action=>''update''%> <%=end_form_tag%> can you make a (just a )small example for my problem -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pokkai Dokkai wrote:> Thorsten Mueller wrote: >> >>> unknown aciton error is occured >> >> then please post the code and the error in more detail >> nobody can know, what''s in your controller and what you call >> >> this >> $(''form_id'').action=''#{article_images_path(article)}'' >> is only an example, you must replace article_images_path >> with an url that points to your controller/action >> as you would use it eg in a link_to >actually the eruby function start_form_tag is a deprecate from form_tag the format is "form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block)" how should i write id name in <%start_form_tag %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Not exactly what you asked for, but you could check params[:commit] in
the controller to see which submit was clicked.
<% form_for(:my_model, :url => my_models_path) do |f| %>
<%= submit_tag "submit1" %><br />
<%= submit_tag "submit2" %>
<% end %>
class MyModelsController < ApplicationController
def create
if params[:commit] == "submit1"
# do something
else
# do something else
end
end
end
On Nov 21, 4:18 am, Pokkai Dokkai
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Pokkai Dokkai wrote:
> > Thorsten Mueller wrote:
>
> >>> unknown aciton error is occured
>
> >> then please post the code and the error in more detail
> >> nobody can know, what''s in your controller and what you
call
>
> >> this
> >>
$(''form_id'').action=''#{article_images_path(article)}''
> >> is only an example, you must replace article_images_path
> >> with an url that points to your controller/action
> >> as you would use it eg in a link_to
>
> actually the eruby function start_form_tag is a deprecate from form_tag
> the format is
> "form_tag(url_for_options = {}, options = {}, *parameters_for_url,
> &block)"
> how should i write id name in <%start_form_tag %>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
You can''t have one form inside another. You can have two forms within a single page, just not one imbedded inside another. I have tried it: http://www.ruby-forum.com/topic/113330#new -S -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---