Sebastian Probst Eide
2007-May-20 17:12 UTC
Disabling textfields while submitting ajax call
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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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 Eide <sebastian.probst.e...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sebastian Probst Eide
2007-May-20 22:04 UTC
Re: Disabling textfields while submitting ajax call
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 On May 20, 7:48 pm, dasil003 <gabrie...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 Eide > > <sebastian.probst.e...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > 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--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---