Escape '&' in text_field_with_auto_complete

Good day.

I have searched on the net and through the archives to now avail as of
yet.
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
in
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 =>
“45”,
:value => @supplier.company_name }, :after_update_element =>
“function(element,value){” +
remote_function( :url => { :action =>
:get_supplier_address
}, :with => “‘supplier=’+escape($F(‘supplier_company_name’))”) + “}” %>

controller:

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
starting
with ’ + params[:supplier][:company_name].to_s + ‘!’)
render :partial => ‘no_values’
else
render :partial => “supplier_names”, :layout => false
end
end

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
question?

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

Off to waste more time digging through the web.

Thanks,

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