Disable foms when submitting

Hey,

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 ??

Thanks
N.

Nick B. wrote:

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

Thanks
N.

Hey

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

http://www.rubyonrailsblog.com/articles/2006/10/03/disable-submit-button-after-its-pressed

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
idea…

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!

Cheery-o
Gustav P.
[email protected]