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
-~----------~----~----~----~------~----~------~--~---