# Disabling textfields while submitting ajax call

**URL:** <https://www.ruby-forum.com/t/disabling-textfields-while-submitting-ajax-call/104615>\
**Category:** Rails\
**Created:** [May 20, 2007, 7:12pm UTC](https://www.ruby-forum.com/t/disabling-textfields-while-submitting-ajax-call/104615 "2007-05-20T19:12:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 20, 2007, 7:12pm UTC](https://www.ruby-forum.com/t/disabling-textfields-while-submitting-ajax-call/104615/1 "2007-05-20T19:12:53Z")

</div>

Hi  
I have a form\_remote\_tag-form that submits the contents of a text-  
field to the server. I have added javascript calls that show a spinner  
and hide the submit button while the server is processing the request,  
and would like to disable the textfield too.

I managed to disable the textfield using the prototype call $  
(‘text\_field\_id’).disabled = true; but when I do that the content of  
the text field doesn’t get sent to the server! Is there a way to  
disable the text-field and still get the content sent to the server?

Best regards  
Sebastian

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 20, 2007, 7:49pm UTC](https://www.ruby-forum.com/t/disabling-textfields-while-submitting-ajax-call/104615/2 "2007-05-20T19:49:57Z")

</div>

Without looking up any documentation, isn’t there a hook in the  
prototype function that is called immediately after submitting the  
form that you can use to disable the field after the contents are  
sent?

On May 20, 11:12 am, Sebastian Probst E.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 21, 2007, 12:21am UTC](https://www.ruby-forum.com/t/disabling-textfields-while-submitting-ajax-call/104615/3 "2007-05-21T00:21:30Z")

</div>

The callbacks as listed are:

:loading: Called when the remote document is being loaded with data by  
the browser.  
:loaded: Called when the browser has finished loading the remote  
document.  
:interactive: Called when the user can interact with the remote  
document, even though it has not finished loading.  
:success: Called when the XMLHttpRequest is completed, and the HTTP  
status code is in the 2XX range.  
:failure: Called when the XMLHttpRequest is completed, and the HTTP  
status code is not in the 2XX range.  
:complete: Called when the XMLHttpRequest is complete (fires after  
success/failure if they are present).

Using :loading is working!  
Thanks for the help.

S
