Related to forms

I’m trying to construct a form that would request a page using GET and
would like my variables to be simple like q,v, etc so that the URL it
calls is something like: /controller/action?q=80&v=100

However, I’m having trouble using the basic form helpers (probably doing
something wrong) cos expressions such as:
<%= hidden_field “q”, “v”, {:value => “xyz”} %>
results in something like: query?q%5Bv%5D=xyz

I think I’m missing something somewhere…
Cheers
Mohit.

Hi Mohit,

hidden_field(object_name, method, options = {})

expects a object name and generates a ouput of form object[method] which
is what you are getting but in html escaped format %5B === [ and %5D ===
]

if you want simple form fields you can code manually

but if insist on a rails way
<%= hidden_field “q”, nil, {:value => “80”} %>
<%= hidden_field “v”, nil, {:value => “100”} %>

regards
A.Senthil N.
http://senthilnayagam.com

Senthil N. wrote:

but if insist on a rails way
<%= hidden_field “q”, nil, {:value => “80”} %>
<%= hidden_field “v”, nil, {:value => “100”} %>

Thanks Senthil,

I would have liked to stay the Rails way and that was why I was asking
(I am aware of the direct HTML manual way). I used what you suggested
as the Rails way.

It works fine on the controller side - I can use the variable params[:q]
and params[:v] to construct my query! Thanks.
However, the GET request still goes with blank box brackets so it is
called as:
/controller/query?start%5B%5D=2006-07-12&stop%5B%5D=2006-08-12

It works fine, but it looks a bit ugly, so I guess I’ll have to stick
with the manual way for now…

Cheers
Mohit.