I’m using autoforms to build a rather lengthy form. SOme fields are populated by default values and I do not wish for them to appear since the end user will mostly not be touching them unless there is a specific necessity. I went through the documentation for autoforms and the demo page, but nothing is clearely mentioned about how to have these fields hidden away and then shown upon clicking on ‘Advanced’ or something like that. A little advice on how to get this thing going will be useful.
On the autoform.meteorapp.com link you referenced, take a look at the Field Values page specifically. The afFieldValueIs and afFieldValueContains helpers will help with this. The demo shows how (click on any of the radio buttons / checkboxes to see hidden fields appear).
I had initially taken a look at that, I am under the impression that the approach mentioned there is more strictly bound to the filed. Only if the option validates to a ‘Yes’, then the rest of the form shows up.
What I’m looking to achieve is for the form to auto hide the default (Advanced) fields and provide a simple advanced link or button. Upon clicking that button, the rest of the form should show up.
Let me take a second look at what you mentioned to see if it’s feasible.
You could always consider making your “Advanced” link a checkbox instead, then leverage the afFieldValueContains helper. If you want to use a link though you can handle this outside of Autoform via Blaze instead. When creating your form, instead of using the Autoform’s quickForm option, build the full form leveraging afQuickField or afFieldInput to build each form element separately. You can then wrap your advanced fields in a div, and wire up a click event in your Template that will hide/show the advanced fields.