Forum: Ruby on Rails Autocompleter to read value from hidden field

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jesper Rønn-Jensen (Guest)
on 2006-04-18 00:40
(Received via mailing list)
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!

--
Emin H. (Guest)
on 2006-04-18 23:34
(Received via mailing list)
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.
This topic is locked and can not be replied to.