Disabling textfields while submitting ajax call


#1

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


#2

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.


#3

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