text_field_with_auto_complete

Hi Shandy,

bill walton wrote:

Hi Shandy,

I need to pass a parameter in my text_field_with_auto_complete

What's the parameter supposed to do? What are you trying to accomplish?

Bill

Well, I have an auto_complete to get users names, and in other forms it
works great. This auto_complete, however, it first asks the user to
select an account and then pull all the users from that account, so the
parameter that I need to pass is the id to the account to populate that
list.

Ah. Ok. It's been a while since I used auto_complete and haven't
tested this, but it should point you in the right general direction.
First though, note that everything after the first two parameters is
interpreted as elements of a hash. You don't need the {} notation. The
items that can appear in that hash are the parameters to
ActiveRecord::Base#find. IIRC auto_complete just passes them through to
the find. You're wanting to supply the :conditions. The syntax may be
wrong but I already warned you I haven't tested it. :wink:

<%= text_field_with_auto_complete 'user', 'username', :conditions =>
["post = ?", @company_title.id] %>

HTH,
Bill