I have problem submiting a form follow by redirecting the user using a link. I am currently using form_for. Is it the right way? Or I should use form_remote_tag? Can anyone please help me? -- 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 -~----------~----~----~----~------~----~------~--~---
fries 88 wrote:> I have problem submiting a form follow by redirecting the user using a > link. I am currently using form_for. Is it the right way? Or I should > use form_remote_tag? Can anyone please help me?I''m not sure what you mean. Are you trying to submit a form using a link (instead of a button)? form_for will create a form that posts to some action, then renders whatever that action decides to do (which may be a redirect). form_remote_tag submits the form asynchronously -- this is for Ajax -- and can render some content on completion, but you shouldn''t redirect after an Ajax response. -- 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 -~----------~----~----~----~------~----~------~--~---
Why do you want to use a link? It''s really not such a good idea, as people are generally used to using a button. If it''s an absolute requirement, the approach I have always taken is to apply CSS to the button to make it look like a link. Other solutions involve making the link call a javascript function that submits the form. Yuk. On 1/9/08, fries 88 <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I have problem submiting a form follow by redirecting the user using a > link. I am currently using form_for. Is it the right way? Or I should > use form_remote_tag? Can anyone please help me? > -- > 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 -~----------~----~----~----~------~----~------~--~---
Brian Hogan wrote:> Why do you want to use a link? It''s really not such a good idea, as > people > are generally used to using a button. > > If it''s an absolute requirement, the approach I have always taken is to > apply CSS to the button to make it look like a link. > > Other solutions involve making the link call a javascript function that > submits the form. Yuk.<%= link_to_function ''Submit'', "$(''form_id'').submit()" %> But yeah, yuk. Stick with a button unless there''s a good reason for a link (design-wise). -- 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 -~----------~----~----~----~------~----~------~--~---
Jeremy Weiskotten wrote:> Brian Hogan wrote: >> Why do you want to use a link? It''s really not such a good idea, as >> people >> are generally used to using a button. >> >> If it''s an absolute requirement, the approach I have always taken is to >> apply CSS to the button to make it look like a link. >> >> Other solutions involve making the link call a javascript function that >> submits the form. Yuk. > > <%= link_to_function ''Submit'', "$(''form_id'').submit()" %> > > But yeah, yuk. Stick with a button unless there''s a good reason for a > link (design-wise).Hmm...So which form should i use? I am supposed to save the various fields and go to the next page when i click the link which i am going to name next. I have tried to give the form_for an id by doing this: <% form_for :e0_1_prod_desc,:id => ''prod'', :url => { :action => :save_prod_desc } do |n| %> Is it the right way? And i just saw from somewhere, <%= link_to_function ''Submit'', "$(''form_id'').submit(0)" %> Why is submit(0)? What is the difference between submit(0) and submit()? 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 -~----------~----~----~----~------~----~------~--~---
Re: Submit a form using a link Posted by fries 88 (fries88) on 10.01.2008 03:42 Jeremy Weiskotten wrote:> Brian Hogan wrote: >> Why do you want to use a link? It''s really not such a good idea, as >> people >> are generally used to using a button. >> >> If it''s an absolute requirement, the approach I have always taken is to >> apply CSS to the button to make it look like a link. >> >> Other solutions involve making the link call a javascript function that >> submits the form. Yuk. > > <%= link_to_function ''Submit'', "$(''form_id'').submit()" %> > > But yeah, yuk. Stick with a button unless there''s a good reason for a > link (design-wise).Hmm...So which form should i use? I am supposed to save the various fields and go to the next page when i click the link which i am going to name next. I have tried to give the form_for an id by doing this: <% form_for :e0_1_prod_desc,:id => ''prod'', :url => { :action => :save_prod_desc } do |n| %> Is it the right way? And i just saw from somewhere, <%= link_to_function ''Submit'', "$(''form_id'').submit(0)" %> Why is submit(0)? What is the difference between submit(0) and submit()? 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 -~----------~----~----~----~------~----~------~--~---
Ruby is not FORTRAN! It does not have limits on the names of its objects, fields or anything! So why are you limiting description down to "desc" and what I can only assume to be product down to "prod". This is not readable. Why are you using a link to submit the form? Use remote_form_for: http://noobkit.com/show/ruby/rails/rails-edge/actionpack-edge/actionview/helpers/prototypehelper/remote_form_for.html -- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> Ruby is not FORTRAN! It does not have limits on the names of its > objects, > fields or anything! So why are you limiting description down to "desc" > and > what I can only assume to be product down to "prod". This is not > readable. > > Why are you using a link to submit the form? Use remote_form_for: > > http://noobkit.com/show/ruby/rails/rails-edge/actionpack-edge/actionview/helpers/prototypehelper/remote_form_for.html > > -- > Ryan Bigg > http://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.Hi, I might not be clear in the previous postings. From what I understand a form can only have one submit button.Thats why I want to use link. What I want to do is to have two submit links in a form(named previous and next respectively). So no matter which link I click, I will save the form and get redirected to another page. Which shows and other form which does the same saving action. As I am a beginner, I might be a bit slow in understanding remote_form_for. Therefore if remote_form_for is a better option, please explain. Thanks, fries88 -- 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 -~----------~----~----~----~------~----~------~--~---
Hah! I get it now. No, a form can have as many submit buttons as you want. <%=submit_tag "Previous" %> <%=submit_tag "Next" %> These tags generate <input type="submit" name="commit" value="Previous" /> <input type="submit" name="commit" value="Next" /> When your user clicks the button, only that value is sent to the server. In the controller, you can do this: if params[:commit] == "Previous" # stuff goes here elsif params[:commit] == "Next" # stuff goes here. end Does that help? On Jan 9, 2008 9:31 PM, fries 88 <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ryan Bigg wrote: > > Ruby is not FORTRAN! It does not have limits on the names of its > > objects, > > fields or anything! So why are you limiting description down to "desc" > > and > > what I can only assume to be product down to "prod". This is not > > readable. > > > > Why are you using a link to submit the form? Use remote_form_for: > > > > > http://noobkit.com/show/ruby/rails/rails-edge/actionpack-edge/actionview/helpers/prototypehelper/remote_form_for.html > > > > -- > > Ryan Bigg > > http://www.frozenplague.net > > Feel free to add me to MSN and/or GTalk as this email. > > > > Hi, > > I might not be clear in the previous postings. From what I understand a > form can only have one submit button.Thats why I want to use link. What > I want to do is to have two submit links in a form(named previous and > next respectively). So no matter which link I click, I will save the > form and get redirected to another page. Which shows and other form > which does the same saving action. > > As I am a beginner, I might be a bit slow in understanding > remote_form_for. Therefore if remote_form_for is a better option, please > explain. > > Thanks, > fries88 > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Ooo Brian''s so close he can SMELL IT. What he said only applies to standard forms, not ajax forms. If you''re using remote_form_for and you have multiple submit_tags, because of remote_form_for works, it''ll only ever submit using the first submit tag you''ve put in. I''ve posted a ticket on dev.rubyonrails.org about this a while back, and I haven''t done anything about it since: http://dev.rubyonrails.org/ticket/10026 On Jan 10, 2008 2:08 PM, Brian Hogan <bphogan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hah! I get it now. > > No, a form can have as many submit buttons as you want. > > <%=submit_tag "Previous" %> > <%=submit_tag "Next" %> > > These tags generate > <input type="submit" name="commit" value="Previous" /> > <input type="submit" name="commit" value="Next" /> > > When your user clicks the button, only that value is sent to the server. > > In the controller, you can do this: > > if params[:commit] == "Previous" > # stuff goes here > elsif params[:commit] == "Next" > # stuff goes here. > end > > Does that help? > > > > On Jan 9, 2008 9:31 PM, fries 88 < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > > > Ryan Bigg wrote: > > > Ruby is not FORTRAN! It does not have limits on the names of its > > > objects, > > > fields or anything! So why are you limiting description down to "desc" > > > and > > > what I can only assume to be product down to "prod". This is not > > > readable. > > > > > > Why are you using a link to submit the form? Use remote_form_for: > > > > > > > > http://noobkit.com/show/ruby/rails/rails-edge/actionpack-edge/actionview/helpers/prototypehelper/remote_form_for.html > > > > > > -- > > > Ryan Bigg > > > http://www.frozenplague.net > > > Feel free to add me to MSN and/or GTalk as this email. > > > > > > > > Hi, > > > > I might not be clear in the previous postings. From what I understand a > > form can only have one submit button.Thats why I want to use link. What > > I want to do is to have two submit links in a form(named previous and > > next respectively). So no matter which link I click, I will save the > > form and get redirected to another page. Which shows and other form > > which does the same saving action. > > > > As I am a beginner, I might be a bit slow in understanding > > remote_form_for. Therefore if remote_form_for is a better option, please > > explain. > > > > Thanks, > > fries88 > > > > -- > > Posted via http://www.ruby-forum.com/. > > > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Brian Hogan wrote:> Hah! I get it now. > > No, a form can have as many submit buttons as you want. > > <%=submit_tag "Previous" %> > <%=submit_tag "Next" %> > > These tags generate > <input type="submit" name="commit" value="Previous" /> > <input type="submit" name="commit" value="Next" /> > > When your user clicks the button, only that value is sent to the server. > > In the controller, you can do this: > > if params[:commit] == "Previous" > # stuff goes here > elsif params[:commit] == "Next" > # stuff goes here. > end > > Does that help?O I see. Yup it is much clearer now. But just to make sure, this are the changes I made to my controller: def Prod_Desc @product = Product.new end def save_prod_desc @product = Product.new(params[:product]) if @product.save && params[:commit] == "Previous" redirect_to :action => ''Previous_Page'' elsif @product.save && params[:commit] == "Next" redirect_to => ''Next_Page'' else render :action=> ''Prod_Desc'' end end And I am still using form_for and I just added <p><%=submit_tag "Next" %></p> and <p><%=submit_tag "Previous" %></p> Is it correct? -- 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 -~----------~----~----~----~------~----~------~--~---
Close... Try this: def save_prod_desc @product = Product.new(params[:product]) if @product.save if params[:commit] == "Previous" redirect_to :action => ''previous_page'' elsif params[:commit] == "Next" redirect_to :action=> ''next_page'' end else render :action=> ''prod_eesc'' end end Also... refactor your actions. Controller actions should not start with upper-case letters. They are methods. Anything starting with an uppercase letter is a Constant in Ruby. I lower-cased them in the above code. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jan 9, 2008 9:52 PM, Ryan Bigg <radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ooo Brian''s so close he can SMELL IT. > > What he said only applies to standard forms, not ajax forms. > > If you''re using remote_form_for and you have multiple submit_tags, because > of remote_form_for works, it''ll only ever submit using the first submit tag > you''ve put in. I''ve posted a ticket on dev.rubyonrails.org about this a > while back, and I haven''t done anything about it since: http://dev.rubyonrails.org/ticket/10026 >Ahh but he''s not trying to use ajax forms. He wants to use standard forms. I believe *you* suggested he do it with AJAX which is completely unnecessary in this instance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mind got fuddled, apologies. On Jan 10, 2008 2:53 PM, Brian Hogan <bphogan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Jan 9, 2008 9:52 PM, Ryan Bigg <radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Ooo Brian''s so close he can SMELL IT. > > > > What he said only applies to standard forms, not ajax forms. > > > > If you''re using remote_form_for and you have multiple submit_tags, > > because of remote_form_for works, it''ll only ever submit using the first > > submit tag you''ve put in. I''ve posted a ticket on dev.rubyonrails.orgabout this a while back, and I haven''t done anything about it since: http://dev.rubyonrails.org/ticket/10026 > > > > > Ahh but he''s not trying to use ajax forms. He wants to use standard forms. > I believe *you* suggested he do it with AJAX which is completely unnecessary > in this instance. > > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> Mind got fuddled, apologies. > > On Jan 10, 2008 2:53 PM, Brian Hogan <bphogan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > submit tag you''ve put in. I''ve posted a ticket on dev.rubyonrails.orgabout this a while back, and I haven''t done anything about it since: http://dev.rubyonrails.org/ticket/10026 >> > >> >> >> Ahh but he''s not trying to use ajax forms. He wants to use standard forms. >> I believe *you* suggested he do it with AJAX which is completely unnecessary >> in this instance. >> >> >> > >> > > > -- > Ryan Bigg > http://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.Hi, Thank you for all your advise guys. They really helped me :) But I am really curious about why using a link is not that advisable? If I really need to use link, is it possible to make it work like a submit button? And is it possible to combine save and update in a button/link? Like if I have already saved the fields, I can update that page by clicking the same button I used to save after I have been redirect to many other pages? Thanks, fries88 -- 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 -~----------~----~----~----~------~----~------~--~---
Think of the HTML. They are completely different types: Button => <input>... Link => <a href="example.com/...."> Button => POST (or GET) Link => GET It''s just how they decided to implement HTML. We''ve been dealing with this since HTML was introduced. Links should also be idempotent (adjective: denoting an element of a set that is unchanged in value when multiplied or otherwise operated on by itself.). GET requests should have no effect other than returning the information requested. Links use HTTP GET requests and should be safe to be reused over-and-over without adverse side- effects. In order to force a link do a POST, well that takes some JavaScript. Users generally don''t expect this behavior from a web application. Hope that helps explain things a bit. On Jan 10, 12:14 am, fries 88 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ryan Bigg wrote: > > Mind got fuddled, apologies. > > > On Jan 10, 2008 2:53 PM, Brian Hogan <bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> > submit tag you''ve put in. I''ve posted a ticket on dev.rubyonrails.orgabout this a while back, and I haven''t done anything about it since:http://dev.rubyonrails.org/ticket/10026 > > >> Ahh but he''s not trying to use ajax forms. He wants to use standard forms. > >> I believe *you* suggested he do it with AJAX which is completely unnecessary > >> in this instance. > > > -- > > Ryan Bigg > >http://www.frozenplague.net > > Feel free to add me to MSN and/or GTalk as this email. > > Hi, > Thank you for all your advise guys. They really helped me :) > > But I am really curious about why using a link is not that advisable? If > I really need to use link, is it possible to make it work like a submit > button? And is it possible to combine save and update in a button/link? > Like if I have already saved the fields, I can update that page by > clicking the same button I used to save after I have been redirect to > many other pages? > > Thanks, > fries88 > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Anybody remember Google''s Web Accelerator? (http:// webaccelerator.google.com/) Then this article appeared "Googles Accelerator Breaks Web Apps, Security" http://www.eweek.com/c/a/Search/Googles-Accelerator-Breaks-Web-Apps-Security/ "Web Accelerators problems appear to extend beyond forum sites, though. Web-based software developer 37Signals LLC began blocking the program after discovering that it was initiating links which performed critical functions, such as account deletions, on 37Signals Web applications." Jason Fried''s article http://www.37signals.com/svn/archives2/google_web_accelerator_hey_not_so_fast.php That''s why I only use links to link to another page/file. But maybe Google has "fixed" it. my 2 cents John On Jan 10, 1:38 am, Robert Walker <rwalker...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Think of the HTML. They are completely different types: > Button => <input>... > Link => <a href="example.com/...."> > > Button => POST (or GET) > Link => GET > > It''s just how they decided to implement HTML. We''ve been dealing with > this since HTML was introduced. > > Links should also be idempotent (adjective: denoting an element of a > set that is unchanged in value when multiplied or otherwise operated > on by itself.). GET requests should have no effect other than > returning the information requested. Links use HTTP GET requests and > should be safe to be reused over-and-over without adverse side- > effects. > > In order to force a link do a POST, well that takes some JavaScript. > Users generally don''t expect this behavior from a web application. > > Hope that helps explain things a bit. > > On Jan 10, 12:14 am, fries 88 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > Ryan Bigg wrote: > > > Mind got fuddled, apologies. > > > > On Jan 10, 2008 2:53 PM, Brian Hogan <bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >> > submit tag you''ve put in. I''ve posted a ticket on dev.rubyonrails.orgabout this a while back, and I haven''t done anything about it since:http://dev.rubyonrails.org/ticket/10026 > > > >> Ahh but he''s not trying to use ajax forms. He wants to use standard forms. > > >> I believe *you* suggested he do it with AJAX which is completely unnecessary > > >> in this instance. > > > > -- > > > Ryan Bigg > > >http://www.frozenplague.net > > > Feel free to add me to MSN and/or GTalk as this email. > > > Hi, > > Thank you for all your advise guys. They really helped me :) > > > But I am really curious about why using a link is not that advisable? If > > I really need to use link, is it possible to make it work like a submit > > button? And is it possible to combine save and update in a button/link? > > Like if I have already saved the fields, I can update that page by > > clicking the same button I used to save after I have been redirect to > > many other pages? > > > Thanks, > > fries88 > > -- > > 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 -~----------~----~----~----~------~----~------~--~---