mercredi 12 août 2015

Formtastic - Add text field when other checkbox is clicked

I'm using ActiveAdmin which in turn uses Formtastic to create a form.

Currently, the form has multi-option checkbox fields like so:

[]Option 1
[]Option 2
[]Option 3
[]Option 4
[]Other

For the 'Other' option, if a user clicks that particular checkbox I would like to add an empty text field, so that the user can then fill that out and have it save to that database table.

I'm new to Rails and I am unsure how to go about this. Reading through the docs on Formtastic checkboxes, I am unable to find a solution. But perhaps this is something I shouldn't be looking into with Formtastic, but should add dynamically jQuery?




Aucun commentaire:

Enregistrer un commentaire