Is there any hidden command in link_to function?

hi,

i want to know how to pass hiddend values in link_to. if anybody know
please tell me.

Thanks in addvane.

you can use :method => :post
as a aprameter for the options hash. This will create some javascript
which will make the link submit by POST rather then GET.
That way, the parameters won’t show up in the URL. but of course the
“hidden” parameters will still be in the pages’ source code.

Thorsten wrote:

you can use :method => :post
as a aprameter for the options hash. This will create some javascript
which will make the link submit by POST rather then GET.
That way, the parameters won’t show up in the URL. but of course the
“hidden” parameters will still be in the pages’ source code.

Thanks for ur reply. i did like this. but value is not passing.

link_to “Edit”, :action=>“user”, :method => post, :values => { id =>
user.id }

but its not working

it’s

:method => :post

not

:method => post

On 5/15/07, [email protected]

and it doesn’T belong in the URL hash, but in the options hash …

link_to “Edit”, { :action=>“user”, :id => user.id }, {:method
=> :post }

link_to “Edit”, :action=>“user”, :method => post, :values => { id =>
user.id }

but its not working

as chris hall posted, as well as passing the :values next to the :action
call like so:

link_to “Edit”, ({:action => “user”, :id => user.id}, :method => :post)

Thorsten wrote:

and it doesn’T belong in the URL hash, but in the options hash …

link_to “Edit”, { :action=>“user”, :id => user.id }, {:method
=> :post }

hi,

I used this command. but still id is displying. for me, id shouldn’t
display in the browser. it should be a hidden field. can any one help me
please

ok, i’m confused, what are you expecting this method to do for you?
you say “id is displying for me, id shouldn’t display in the browser.
it should be a hidden field.”

so which is it? a link or a hidden form field?

Chris

On 5/15/07, [email protected]

Hi,

link_to “Edit”, { :action=>“user”, :id => user.id }, {:method
=> :post }
I used this command. but still id is displying. for me, id shouldn’t display in the browser. it should be a hidden field.
Everything is fine now with your link_to. The only problem here is that
“id” is a somehow special field in rails, as are also controller and
action. Those parameters are automagically matched according to the
rules defined in the routes.rb file, so if you are using id, link_to is
going to use the route defined by " map.connect
‘:controller/:action/:id’".

If you don’t like that, you have one of two options: either change the
route in routes.rb or use a different parameter than id, and then in
your controller read that from the params object.

Regards,

javier ramirez