RJS page question

Guest wrote:

Hey there I'm trying to test this condition in an RJS template

if page['search'].value == "somequerystring"

And it never returns true. Any ideas?

I've used page['element'] = value for setting a textbox in the past with no problem. Not sure what checking the value would fail.


-- Posted via http://www.ruby-forum.com/.

RJS templates are a bit misleading. They are produced server side and don't have access to the state of the client side. So you can't test on the value of something on the page in the RJS template itself.

You can render a JS conditional, or you can pass the value you are interested in as a parameter to the call that invokes the RJS action.