Forum: Ruby on Rails How to add Form values to a url using helper

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.
ã?¹ã?¿ã?³ ã??ã?ºã?¬ã??ã?¯ (Guest)
on 2006-06-06 11:28
(Received via mailing list)
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
Wilson B. (Guest)
on 2006-06-07 16:23
(Received via mailing list)
On 6/6/06, $B%9%?%s(B $B%^%:%l%C%/(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.
This topic is locked and can not be replied to.