Hi there, Has anyone an idea why the below form - submits correctly when I click the ''Submit'' button - but does call the ''new'' action instead of ''create'' when I hit ENTER? <% form_remote_tag :html => { :action => url_for(:controller => ''pages'', :action => ''create'') } do -%> <%= text_field :page, :title %> <%= submit_to_remote ''blah'', ''Submit'', :url => {:controller => ''pages'', :action => ''create''} %> <% end -%> Thanks a lot for any hints! Tom -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 27 May 2010 18:24, Tom Ha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi there, > > Has anyone an idea why the below form > - submits correctly when I click the ''Submit'' button > - but does call the ''new'' action instead of ''create'' when I hit ENTER? > > > <% form_remote_tag :html => { :action => url_for(:controller => ''pages'', > :action => ''create'') } > do -%> > > <%= text_field :page, :title %> > <%= submit_to_remote ''blah'', ''Submit'', :url => {:controller => > ''pages'', > :action => ''create''} > %> > > <% end -%>Firstly it may be worth checking the html of the page is valid (view the source in your browser and copy and paste the complete html into the w3c html validator - find it with google if necessary). Assuming html is valid is it possible that Enter is hitting a different button or link on the page? Does the log give any clues? I seem to remember a discussion here about this a little time ago, but I don''t remember the result. A bit of searching here and googling may be useful. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Hassan Schroeder
2010-May-27 21:33 UTC
Re: Ajax submit: Clicking ''Submit'' vs. hitting ENTER
On Thu, May 27, 2010 at 1:03 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Assuming html is valid is it possible that Enter is hitting a > different button or link on the page? Does the log give any clues?Besides the above, use FF/Firebug to 1) confirm there are no JavaScript errors occurring 2) compare the network traffic generated by each event FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Frederick Cheung
2010-May-27 21:36 UTC
Re: Ajax submit: Clicking ''Submit'' vs. hitting ENTER
On May 27, 6:24 pm, Tom Ha <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi there, > > Has anyone an idea why the below form > - submits correctly when I click the ''Submit'' button > - but does call the ''new'' action instead of ''create'' when I hit ENTER? > > <% form_remote_tag :html => { :action => url_for(:controller => ''pages'', > :action => ''create'') } > do -%> > > <%= text_field :page, :title %> > <%= submit_to_remote ''blah'', ''Submit'', :url => {:controller => > ''pages'', > :action => ''create''} > %> > > <% end -%> >Well it should be ok to have that submit tag just be a normal submit tag. Secondly if my memory is correct, passing the html => :action option is only for setting up a fallthrough for if the user doesn''t have javascript (check what gets generated). You also need to say something like form_remote_tag :url => {:controller => pages ... Fred> Thanks a lot for any hints! > Tom > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On May 27, 10:24 pm, Tom Ha <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi there, > > Has anyone an idea why the below form > - submits correctly when I click the ''Submit'' button > - but does call the ''new'' action instead of ''create'' when I hit ENTER? > > <% form_remote_tag :html => { :action => url_for(:controller => ''pages'', > :action => ''create'') } > do -%> > > <%= text_field :page, :title %> > <%= submit_to_remote ''blah'', ''Submit'', :url => {:controller => > ''pages'', > :action => ''create''} > %> > > <% end -%> >You should confirm that your page has multiple form_tags? as like form within another(inner forms). actions is going to the first form action when you are using 2 forms in your page You can try with the following <%=javascript_include_tag "prototype"%> <form> <%= text_field :page, :title %> <%= submit_to_remote ''blah'', ''Submit'', :url => {:action => ''create''},:update=>"SS"%> </form> <div id="SS"></div> -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On May 27, 10:24 pm, Tom Ha <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi there, > > Has anyone an idea why the below form > - submits correctly when I click the ''Submit'' button > - but does call the ''new'' action instead of ''create'' when I hit ENTER? > > <% form_remote_tag :html => { :action => url_for(:controller => ''pages'', > :action => ''create'') } > do -%> > > <%= text_field :page, :title %> > <%= submit_to_remote ''blah'', ''Submit'', :url => {:controller => > ''pages'', > :action => ''create''} > %> > > <% end -%> >You should confirm that your page has multiple form_tags? as like form within another(inner forms). actions is going to the first form action when you are using 2 forms in your page You can try with the following <%=javascript_include_tag "prototype"%> <form> <%= text_field :page, :title %> <%= submit_to_remote ''blah'', ''Submit'', :url => {:action => ''create''},:update=>"SS"%> </form> <div id="SS"></div> -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On May 27, 10:24 pm, Tom Ha <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi there, > > Has anyone an idea why the below form > - submits correctly when I click the ''Submit'' button > - but does call the ''new'' action instead of ''create'' when I hit ENTER? > > <% form_remote_tag :html => { :action => url_for(:controller => ''pages'', > :action => ''create'') } > do -%> > > <%= text_field :page, :title %> > <%= submit_to_remote ''blah'', ''Submit'', :url => {:controller => > ''pages'', > :action => ''create''} > %> > > <% end -%> >You should confirm that your page has multiple form_tags? as like form within another(inner forms). actions is going to the first form action when you are using 2 forms in your page You can try with the following <%=javascript_include_tag "prototype"%> <form> <%= text_field :page, :title %> <%= submit_to_remote ''blah'', ''Submit'', :url => {:action => ''create''},:update=>"SS"%> </form> <div id="SS"></div> -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Thanks for all the feedback! Fred''s nailed it and all other hints were instructive as well! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.