Hi, I''m using rails 3 and have an ajax form where users can add data, click submit, and it will be appended to a feed. The problem is if the users click submit (or press enter) multiple times, the form seems to be submitted multiple times as well resulting in the same item showing in the feed multiple times. this is what my form tag looks like: <% form_for Discovery.new, :remote=>true, :loading=>"Form.Element.disable(''commit'')", :complete=>"Form.Element.enable(''commit'')" do |f| %> ... <%= f.submit ''Create'', :id => "commit" %> as you can see i''ve tried to disable the submit button. however the javascript code does not get generated. Would very much appreciate some help with this. Cheers, Soheil -- 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 28 May 2010 20:45, soheil danesh <soheildb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''m using rails 3 and have an ajax form where users can add data, > click submit, and it will be appended to a feed. The problem is if the > users click submit (or press enter) multiple times, the form seems to > be submitted multiple times as well resulting in the same item showing > in the feed multiple times. > > this is what my form tag looks like: > <% form_for > Discovery.new, :remote=>true, :loading=>"Form.Element.disable(''commit'')", :complete=>"Form.Element.enable(''commit'')" > do |f| %> > > ... > > > <%= f.submit ''Create'', :id => "commit" %> > > as you can see i''ve tried to disable the submit button. however the > javascript code does not get generated.I don''t see anything there that will disable the button after it is clicked. Have a look at the disable_with option on f.submit. 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.