Autocompleter to read value from hidden field


#1

I have an autocomplete field with road names (looking up in a database
with
approx. 100,000 road names).
To limit the number of roads, i want an extra input field where to put
postal code.

I’m currently using <%= text_field_with_auto_complete %> for the field.

What is the best way in Rails to intercept the Ajax call and send the
value
of the postal_code field?

(I guess I could do it by hand, but I think that there is a smarter way
of
doing this).

Thanks!


#2

I believe you could play with the “:with” parameter of observe_field to
send
value of both fields with AJAX call instead of value of only the
observed
field. For that, I would think you should put some javascript function
that
collects the value and concatenates it in some form to the value of
observed
field.