I'm pretty new to ruby and rails and have been racking my brain for a
few hours on this one.  I have set up a text_field_with_auto_complete
and it works great.  It talks to my controller correctly, firing my
method that queries mySQL and returns a nice <ul> to select from all
with CSS.  Ok great.

Now I want to be able to capture the ID of the item that the user will
select from.  I have tried using :after_update_element as described on
script.aculo.us and elsewhere on the web.  No luck.  It never seems to
fire.

As a test I created a javascript file (placed it in the javascripts
folder, and include it in my header) that looks like this:

function get(text, li) {
        alert(li.id);
}

Then I call this function from my autocompleter text field like so:

Plan Name:
<%= text_field_with_auto_complete :plan, :name, {}, :skip_style =>
true, :frequency => 0, :indicator => "spinner", :after_update_element
=> 'get' -%>
<%= image_tag 'spinner.gif', :id => 'spinner', :style => 'display:
none'%>

Oh, and my dropdown partial looks like this:

<ul class="plans">
        <% for plan in @plans do -%>
        <li id="<%= plan.id %>", class="plan"><%= plan.name%></li>
        <% end %>
</ul>

I don't get any alert called.  I've tried so many variations with no
luck.  Any help would be greatly appreciated.

Thanks!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to