Escape '&' in text_field_with_auto_complete

Good day.

I have searched on the net and through the archives to now avail as of
I have a text_field_with_auto_complete that searches for company names.
These company names obviously can have an ‘&’ in the name of the company
(example Barnes & Nobel).
The auto complete works beautifully.

However, the problem arises when I pass the name of the company to the
controller to use in searching the customers for the other information
the database relevant to the customer.

Error result ==> :company_name => "Barnes ", :Nobel => “”
Expected/Desired result ==> :company_name => “Barnes & Nobel”

Code in view:

<%= text_field_with_auto_complete :supplier, :company_name, { :size =>
:value => @supplier.company_name }, :after_update_element =>
“function(element,value){” +
remote_function( :url => { :action =>
}, :with => “‘supplier=’+escape($F(‘supplier_company_name’))”) + “}” %>


def auto_complete_for_supplier_company_name
@suppliers = Supplier.find(:all, :conditions => [“company_name LIKE
params[:supplier][:company_name] + ‘%’])
if @suppliers.length == 0
flash_warning(:now, 'No Suppliers found with company name
with ’ + params[:supplier][:company_name].to_s + ‘!’)
render :partial => ‘no_values’
render :partial => “supplier_names”, :layout => false

Thoughts on how to get the expected value here?

So, does this mean no one has this situation at all, or that everyone
considers it so trivial that they don’t bother responding to the

I would have hoped that someone could have shed some light on the
problem by

Off to waste more time digging through the web.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs