GET params through Radiant page?

Hi guys,

It is possible to access GET parameters passed in the url of a Radiant
page?

For example, I’m making a contact page, and instead of making multiple
enquiry forms (sales, support, general, etc), it would be good if i
could pass a url like ‘/contact/?type=sales’ and then programatically
show different form fields depending on the type of enquiry…

If this is more of a ruby/rails level thing rather than a radiant
thing, can i still do it from my radiant page?

Cheers,

Michael

thanks for the reply sean, i’ll have a think about your suggestion…

Michael,

You can do it, but you’ll need a behavior. By default, all pages are
cached and your page would not be able to respond to the GET
parameters. Another option would be to create child pages of your
“Contact” page called “sales”, “support”, or whatever. Then only the
page that processes the submission of the form would need a behavior,
and your contact pages wouldn’t need to respond to GET params.

Cheers,
Sean C.
seancribbs.com

Hi Michael,

I experienced the same problem, here how I fixed it. I added below 3
lines
of code into models/page_context.rb

<r:page:query_string />

define_tag ‘page:query_string’ do | tag|
tag.globals.page.request.parameters[‘q’] unless
tag.globals.page.request.nil?
end

As you can see, currently it returned only parameter q. I am not 100%
finished with this, but it should be an easy fixed to get other
parameters.
Hopefully it gives you some idea.

This radius tag, so it would be global, and you can use it anywhere in
the
page.

Sean, I tried first to put into page parts and use custom behavior to
extract the parameters object, but for some reason the request object is
always nil at that level. I decided to modify radius instead and it
worked.
I am not sure why this happened.

Best,
Leon Yeh
New Avenue Systems Inc.
Office: (626)254-1757 x880
[email protected]
Imagination Delivered. www.newavenue.net

Thanks Leon, I might give that a try…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs