Wednesday, January 20, 2010

[Rails] disable submit_tag after click

This code disables the 'Save' button once clicked, but doesn't seem to
send the form data.
<%= submit_tag 'Save', :class => 'submit', :onclick =>
"document.getElementById('save_button').disabled=true;", :id =>
"save_button" %>

This code sends the form data and a record is created, but isn't
disabled once clicked. A user can click this many times, creating a new
record each time.
<%= submit_tag 'Save', :class => 'submit', :onclick =>
"document.getElementById('save_button').disabled=true;", :id =>
"save_button" %>

Anyone know of a way to fix the javascript to disable the 'Save' button
and also send the form data when clicked once?

Thanks,

Frank
--
Posted via http://www.ruby-forum.com/.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate