Text_field_with_auto_complete problem

hello all,

I am trying to get a customized text_field_with_auto_complete working
where the generated dropdown will display not only the list of teams
(first line), but also their city and country(second line).

In my view, I have:

Team: <%= text_field_with_auto_complete :team, :name, {}, :skip_style => true %>

In controller:

def auto_complete_for_team_name
unless request.get?
search = ‘%’ + params[:team][:name].downcase + ‘%’
@teams = Team.find(:all, :conditions => [‘LOWER(name) LIKE ? or
LOWER(short_name) like ?’, search, search],
:order => ‘name ASC’)
render :partial => ‘auto_complete_for_team_name’

and in the partial (_auto_complete_for_team_name.rhtml), I have:

    <% for team in @teams do -%>
  • <%=h team.name.camelcase -%>
    <%=h team.city.name.camelcase -%> - <%=h team.city.country.name.camelcase -%> <% end -%>

    and it all works with the exception that when I select on of the items
    from the ajax generated dropdown, the value that gets inserted in the
    the text field has extra spaces on the left (firefox). Safari does not
    even display the selected value in the text field.

    I suspect this to be a css issue but I tried every combination and
    nothing seems to work.

    I also defined the div.auto_complete etc styles as they are by default
    in my css file.

    If anyone had a similar problem or knows what the fix is, I would
    definitely appreciate the help.

    Thanks a lot,

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