Hi, How do I have two links that does the same action, save, and redirects to different pages when different links are clicked. I am now using <%link_to_function ''Previous'', "$(''form_id'').submit()" -%> Example: When user click the ''Previous'' link, he will be redirected to the previous page. If the user click the ''Next'' link, he will be redirected to the next page. Can someone please help me? Thanks -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, In link_to_function tag you can pass the id also depends upon the id you can redirect the pages. link_to_function("Previous", "$(''form_id'').submit()", :id => "previous") link_to_function("Next", "$(''form_id'').submit()", :id => "next") Regards Abirami 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 -~----------~----~----~----~------~----~------~--~---
Abirami Selvam wrote:> Hi, > In link_to_function tag you can pass the id also depends upon the id > you can redirect the pages. > > > link_to_function("Previous", "$(''form_id'').submit()", :id => > "previous") > link_to_function("Next", "$(''form_id'').submit()", :id => "next") > > Regards > > Abirami sHi, I tried the link_to_function("Previous", "$(''form_id'').submit()", :id => "previous") link_to_function("Next", "$(''form_id'').submit()", :id => "next") and in the controller, if params[:id] == "previous" redirect_to :action => ''previous_page'' elsif params[:id] == "next" redirect_to :action => ''next_page'' end It gives me MISSING TEMPLATE error.Can someone tell me where did I go wrong? Thanks -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, do you have the rhtml page for previous_page and next_page regards Abirami -- 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 -~----------~----~----~----~------~----~------~--~---
Abirami Selvam wrote:> Hi, > do you have the rhtml page for previous_page and next_page > > regards > > AbiramiHi, Yes I do have previous_page.rhtml and next_page.rhtml. The MISSING TEMPLATE error says that my save action''s template is missing not the page that I want to redirect to is missing. I tried to use put to print out the id and the result it prints out is nil. How do I let my controller get the id from the link_to_function ? Thanks -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, Syntax for the link_to_function is link_to_function(name, *args, &block) like link_to_function("Previous",{:formId=>''form_id''},:id=>''previous'') you can try this.... May be the params[:formId] have the value. Regards Abirami 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 -~----------~----~----~----~------~----~------~--~---
Abirami Selvam wrote:> Hi, > Syntax for the link_to_function is > > link_to_function(name, *args, &block) > > like > > link_to_function("Previous",{:formId=>''form_id''},:id=>''previous'') > > you can try this.... May be the params[:formId] have the value. > > > Regards > > Abirami SHi, I tried the above code and it gives me an error saying, formIdform_id is not defined. And it doesn''t submit anymore. Where did I do wrong? Thanks -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, can you explain clearly from start Regards Abirami 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 -~----------~----~----~----~------~----~------~--~---