I’m testing a small bit of functionality using RJS. I have a form with
a radio-button set – a Yes button and No button – and a text input.
I’m using observe_form to send the entire form to the server, instead
of observe_field.
What I’d like to happen is to have the text input hidden if I click
Yes and the text input displayed if I click No.
In order to decide what action to perform – show or hide – I need to
know the value of the radio button. I imagine that my rjs template
would look something like this
if value_of_radio == “Yes”
page[“textinput”].hide
else
page[“textinput”].Show
end
I just don’t know how to get that value_of_radio populated.
Any suggestions or pointers will be much appreciated. It could be that
I’m missing something simple, or maybe I’m going about this all wrong.
In order to decide what action to perform – show or hide – I need to
know the value of the radio button. I imagine that my rjs template
would look something like this
if value_of_radio == “Yes”
page[“textinput”].hide
else
page[“textinput”].Show
end
The input values will be in params[], just like with any other request.