How to add Form values to a url using helper


#1

Hi.

Does anybody knows if there is a way to grab input form values when
creating links through rails; something that would look like the
following :

link_to “search”, { :action => “search” }, :with_values =>
‘my_input_field_name’

that would create, via some generated javascript function :), a dynamic
link to

/main/search?my_input_field_name=123

Note that my_input_field_name would be the result of a
text_field_with_auto_complete so there is not necessary a form in the
page… Am i asking too much out of Rails ?

Thanks for any help
Stan


#2

On 6/6/06, e$B%9%?%se(B e$B%^%:%l%C%/e(B removed_email_address@domain.invalid
wrote:

link to

/main/search?my_input_field_name=123

Note that my_input_field_name would be the result of a
text_field_with_auto_complete so there is not necessary a form in the page…
Am i asking too much out of Rails ?

This should do it: (untested, of course)
link_to “search”, { :action => “search” }, :with => “‘some_param=’ +
escape(some_value)”

More common is a form_remote_tag, which does the tedious work for you.
Also see link_to_remote and remote_function, in the API docs.