Nick Brutyn wrote:> 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'' %>
> <table width="100%" border="0"
cellpadding="0" cellspacing="5">
> <tr>
> <td width="150" height="18"
class="label_required"
> align="right">Name</td>
> <td width="10" height="18"> </td>
> <td height="18"><%= text_field
''album_category'', ''name''%></td>
> </tr>
> </table>
> <%= 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.
>
>
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 Paul
gustav-PUm+PnBUKx7YkQIYctQFYw@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---