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 <[EMAIL PROTECTED]> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to