Kevin O. wrote:
On Monday, July 24, 2006, at 2:16 PM, Bill W. wrote:
With form_tag submit buttons I use the " :disable_with => ‘button
label while processing’ " option so that visitors with slow
connections aren’t able to submit forms twice.
How do I do the same thing with button_to?
What does your ‘button_to’ call look like?
You should be able to associate a JS function with the control so that
it will disable the button when it is clicked.
As usual, it turns our Rails makes it even easier than that When I
looked at the documentation for the two I realized they took the same
arguments. Well… except that form_tag takes the :disable_with option
button_to doesn’t. So I just substituted an empty form with the submit
button styled the same way I had the button_to styled.
NOTE: This works fine in the situation I was in, where the button_to
simply taking the visitor to another page. I do have one situation
there are three buttons on the page, two of which do something but
have render => :nothing in the controller, so I’m sure I’ll have to go
something like your suggestion to get one of those two buttons to
when the controller action is done. The other doesn’t need to be
Or maybe I just change the page a bit so I can use the above.
Thanks for your response, though!