Text_field_with_auto_complete and foreign characters

I need a form where the user must enter a city name. I would like to use
an autocomplete_field for the city name, so I have the following code in
my view:

<%= text_field_with_auto_complete ‘entry’, ‘city_name’, :size => 40 %>

and in my controller I have the method:

def auto_complete_for_entry_city_name
@cities = City.find(:all,
:conditions => [ ‘LOWER(name) LIKE ?’,
params[:entry][:city_name].downcase + ‘%’],
:order => ‘name ASC’,
:limit => 10)
render :partial => ‘cities’

This works fine, except when the city name has german umlauts like in
‘Zürich’. It looks like I get the raw text from the city field in my
action method.
I then tried to use the observe_field feature like this:

<%= observe_field(:city_name, :frequency => 0.5, :update => :results, :url => { :controller => 'entries', :action => :find_city, }, :with => "'city_name=' + escape($F('city_name'))" )%>

This works fine with umlauts, too. The :with-option does the trick.
Unfortunately this is not what I need, I want an autocplete field. Is
there a way to escape the text from my input field using “the
text_field_with_auto_complete” ?

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