How can I conditionally show more fields based on the user's answer?

  • Profile Image
    callieheroux
    Asked on February 25, 2018 at 03:51 PM

    I am an equine photographer, and am creating a questionnaire for the owners to answer about themselves and their horse(s) before I head to the photoshoot to get to know them better. Does any one know how I add an "add another" option? If the owner has two or more horses they are doing the photoshoot with, I would like to add an option where they could do the same questions for another horse, by selecting "add another horse" or something like that. I hope I explained that well enough, thanks in advance!

  • Profile Image
    Jim_R
    Answered on February 25, 2018 at 04:57 PM

    Your approach will depend on "how many" you will allow your users to add. If it's a definite number (say, 3 more horses), you can conditionally show / hide fields on your form based on the user's answer on a specific question.

    e.g. Do you want to add more?

    IF Do you want to add more IS EQUAL TO Yes THEN SHOW more fields

    (where more fields are the related fields you wish to have them fill out)

    These and more were discussed in great detail on the articles linked below.

    Related guides:

    How-to-Show-or-Hide-Fields-Base-on-User-s-Answer

    Hide-or-Show-Multiple-Fields-at-Once

    Otherwise, if it's indefinite, where you don't know how many in total they would like to add (say, 5 or 100 or more), then using widgets would help. There are a few to choose from but the CONFIGURABLE LIST WIDGET is by far the most flexible.

    Complete guide: How-to-Set-Up-the-Configurable-List-Widget

    Give these a spin and let us know if you face any issues.