Disable foms when submitting


I want to disable the form when an user submits, I know that u can do
this with javascript. But i dont want to put code for each form on my
website, and I have a lot of forms like…

<%= start_form_tag :action => ‘create’ %>

Name   <%= text_field 'album_category', 'name'%>
<%= submit_tag 'create', 'class' => 'knop' %> <%= end_form_tag %>

Is there something to automatically put the disable stuff in there when
u place a start_form_tag ??


Nick B. wrote:

<td width="150" height="18" class="label_required"



Here’s a blog post that spoke about exactly this issue…


submit_tag also accepts an option :disable_with.
If this is set, the submit_tag is disabled on click, with the button’s
text getting changed to the value of :disable_with…

submit_tag “save”, :disable_with => ‘saving…’

I’ve never used this, but looking at the rdoc, it seems like that’s the

This is a javascript which gets called by the button’s onClick event
though, and you mentioned you weren’t fond of using JS.

Hope this helps!

Gustav P.
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs