Hi i'm fairly new to ruby on rails and i'm creating a form using simple_form and in one bit i have radio buttons and say i have 3 buttons a,b,c so i want it to be if a is pressed then certain text fields show, and if b is pressed a different set of text fields show and similarly for c. Can anyone help me on this?
This is a JavaScript thing, not really specific to Rails. Coincidentally, I just made this sort of behavior in a Drupal site this morning. For this form, there were fields that made sense for postal mail subscribers that did not make sense for email subscribers. So I added a classname to each of the field wrappers -- either 'postal' or 'email' and used that to make my behavior work:
This is using Prototype, I am sure you can use jQuery or "vanilla" JavaScript if that's your thing.
Walter