text_field_with_auto_complete - Trigger on NonSelecting

Hi Vinay,

This shud help you, getCommunity is the action in my controller, which gets called after update. Also notice, that i get the id of chosen value by doing value.id , also events are captured in element and value. Hope this helps.

<%= text_field_with_auto_complete 'salary_review','company', {}, :skip_style => true ,:frequency => 0.1, :indicator => 'status-indicator',       :after_update_element => "function(element,value){" + remote_function(:update => 'salary_review_company', :url => { :action => :getCommunity }, :with => "'id='+ value.id ") + "}" %>

If the user doesn't choose any, i tried using observe_field. But it didn't do too well, so i stopped using it.

Regards, Sandeep G

Vinay wrote:

Thanks Sandeep! will try this soon. "Events are captured in element and value". I dont quite understand that. Can you please explain? I dont know much of JS and am quite new to ROR too. Ideally, I want a functionality like Gmail's To address bar. It should have autocomplete, find_or_create_by_email and an extra feature of a live search after_update_element which updates a div with more info about the contact using the email/name entered in the field. If the entered string does not match any results, it should validate for an email address and create a contact using that info alone. I know its a tall ask :).. but things are falling into place and I just thought it would be helpful to me if you had any tips since you seem to have done something similar to an extent. Thanks again!