2

Please could you help me to think about how best to layout a form.

I have a series of checklist boolean questions (for example, do you want data?). If the answer is yes, I want to show questions further relating to data.

I have a form with the series of boolean questions and another form with the follow up questions to be shown if the answer is true at the top level.

How do I go about revealing the detailed follow up questions if the answer at the top is true?

I tried if true then -- a link to the follow up form, but I'm either expressing it incorrectly or approaching the layout all wrong. I've seen some questions in this post describing methods to help with the reveal, but I don't follow the reasoning behind why.

Thank you.

Gray
  • 677
  • 5
  • 14
Mel
  • 2,481
  • 26
  • 113
  • 273

1 Answers1

2

It sounds like you will need a large nested form, or multiple smaller forms.

You have 2 simple options:

  1. Use Javascript to hide/show nested questions when some checks a box. here is an example: https://stackoverflow.com/a/6358754/1536309

  2. Create a wizard! think about how your form can be completed in a few stages instead of at one time. https://github.com/schneems/wicked this is a good gem for building wizards. You could have each checkbox and its related information be a stage in the wizard, then the last page would submit the entire form contents.

Community
  • 1
  • 1
Blair Anderson
  • 19,463
  • 8
  • 77
  • 114
  • Thank you. I'll look into nesting. I have made separate scaffolds for each element, so hoping to keep everything clean. Thanks for the tips. – Mel Sep 21 '14 at 23:19