Alex Moore
2006-Aug-09 03:12 UTC
[Rails] Two Autocompletes, make first value affect the second
I have two text_field_with_auto_complete
text_field_with_auto_complete :user, :state
text_field_with_auto_complete :user, :suburb
The user fills in the text_field_with autocomplete... but then I want to
filter the results in the suburb with the value they''ve just entered
def auto_complete_for_user_suburb
@suburbs = PostCode.find(:all,
:conditions => ["lower(locality) LIKE ?",
''%'' +
params[:user][:suburb].downcase + ''%''
AND state LIKE "WHATS IN STATE FEILD"
],
:order => ''locality ASC'',
:limit => 12)
render :partial => ''suburbs''
end
my problem is that I can''t work out a way of delivering the text_field
:state contents to the auto_complete_for_user_suburb function.
Any ideas?
