I have an autocomplete field working and it works well. I really need to tell when someone does not choose and item. Based on that I want to ask the person if they want to save the current record. The issue that I have is onblur runs in a loop when I select an item on the list. Is there a better way to do this that I just don''t see? is onblur conflicting with something? Thanks very much. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
The onblur will go in a loop even if I don''t go off the field. Hopefully someone has an idea on how to solve this. thanks On Apr 3, 7:53 am, "robert.fulcher" <robert.fulc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have an autocomplete field working and it works well. I really need > to tell when someone does not choose and item. Based on that I want > to ask the person if they want to save the current record. The issue > that I have is onblur runs in a loop when I select an item on the > list. Is there a better way to do this that I just don''t see? is > onblur conflicting with something? > > Thanks very much.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 3, 2007, at 1:53 PM, robert.fulcher wrote:> I have an autocomplete field working and it works well. I really need > to tell when someone does not choose and item. Based on that I want > to ask the person if they want to save the current record. The issue > that I have is onblur runs in a loop when I select an item on the > list. Is there a better way to do this that I just don''t see? is > onblur conflicting with something?I wanted something like this for model_auto_completer[*] to provide :allow_free_text, which is analogous to your requirement except there are no models involved here. I used the very hidden field, a custom cache field in the text field element, and an onblur handler. The hidden field would be maintained via :after_update_element: function(element, value) { $(hidden_field).value = 1; element.cache = element.value; } and then there''s onblur: if (this.value != this.cache) { $(hidden_field).value = ''''; } -- fxn [*] http://agilewebdevelopment.com/plugins/model_auto_completer --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Xavier, How did you do the onblur handler? This is how I did it: input id="CompanyName" type="text" value="" autocomplete="off" onblur="checkcompany()" size="40" name="data[Company][name]"/> Are you suggesting another way. Please excuse me because I am very new to AJAX. I was thinking that when I tabbed off this field, even though I select something or not it will shoot off the onblur event. Right now it will get into a loop when I select an item. Thanks for the info. On Apr 3, 3:13 pm, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote:> On Apr 3, 2007, at 1:53 PM, robert.fulcher wrote: > > > I have an autocomplete field working and it works well. I really need > > to tell when someone does not choose and item. Based on that I want > > to ask the person if they want to save the current record. The issue > > that I have is onblur runs in a loop when I select an item on the > > list. Is there a better way to do this that I just don''t see? is > > onblur conflicting with something? > > I wanted something like this for model_auto_completer[*] to > provide :allow_free_text, which is analogous to your requirement > except there are no models involved here. I used the very hidden > field, a custom cache field in the text field element, and an onblur > handler. > > The hidden field would be maintained via :after_update_element: > > function(element, value) { > $(hidden_field).value = 1; > element.cache = element.value; > } > > and then there''s onblur: > > if (this.value != this.cache) { > $(hidden_field).value = ''''; > } > > -- fxn > > [*]http://agilewebdevelopment.com/plugins/model_auto_completer--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---