On 28 May 2010 20:45, soheil danesh <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to