3 Replies Latest reply on Jul 24, 2012 8:06 PM by jmrusch

    Way to create a dynamic form that changes as data is entered?

    g@briellelevenson

      Hi FM Devs!

       

      I have been tasked with creating a form where the user will start filling it out, and the form will shift dynamically based on what answers they are providing.

       

      For example, if the form asks "What is your profession?":

       

      If they enter "Doctor", then the form would shift into questions like "What is your specialty?" and "How long have you been in practice?".

      If they enter "Student", then it might ask them questions like "What school are you currently attending?" and "What year will you graduate?".

       

      Some responses might trigger only 1 question, while other responses might trigger 5 more.

       

      The problem is, I could make this work using conditional formatting and calculation fields, except there are going to be blank gaps all over the form where the hidden content lives, and it's going to look disjointed. I wish Filemaker could slide content up/over when things are hidden, but I don't think that's possible. Or if I had a way to collapse/expand sections of the layout, that would work too. The best solution I've come up with so far is to actually create several layouts that look identical up until the branching field, and use script triggers on the data fields to seamlessly send the user to a different layout without them knowing. The problem is, if there are several of these branching fields that can send in different directions, that is multiplying how many layouts I'd need to make. I also thought about using portals to change the data that appears, but can't seem to approach it in a way that makes sense.

       

      Has anybody had to tackle a similar issue? If so, are there any layout tricks you've come across, or any wisdom you can impart? I don't want to tell my employer that it isn't possible to do what they are visualizing, but I'm really questioning whether I can do it cleanly.

       

      Thanks in advance,

      Gabrielle

        • 1. Re: Way to create a dynamic form that changes as data is entered?
          g@briellelevenson

          A colleague just gave me the advice to use a tabbed object at each branching point, and set the script trigger to go to the correct tab depending on what they enter (by using Go To Object).  This will cut down on my real estate and is cleaner than making several new layouts, so it's currently my best option.  And since you can set the tab width to 0 pt, you don't need to worry about someone clicking on an invisible tab or seeing it there.  I am considering this answered, though any better solutions out there are welcome!

          • 2. Re: Way to create a dynamic form that changes as data is entered?
            beverly

            research hierarchical portals. The "child list" changes as each "parent" is toggled. Rather than a Manual toggle you could base it on an answer not empty.

             

            Beverly

            • 3. Re: Way to create a dynamic form that changes as data is entered?
              jmrusch

              Don't know if this is exactly what you're looking for, but here goes...

               

              I had a similar situation where there were several forms with different sets of questions. I didn't want to set up specific layouts for each form, so instead I set up a table for Questions and a table for Answers.

               

              Forms are pre-defined in the Questions table, which allows grouping questions into sections with section titles, and allows for specifying what type of answer is expected for all questions in the section -- for example, multiple choice (references another table of multiple choice possibilities), text, or check box. There is version control, so if a form changes, it goes from 1001A to 1001B, etc.

               

              When a person goes to fill out a form, a new record is created in the Answers table. Fields contain info about the user and form version, such as 1001B. There's a relationship back to the Questions table to pull information about the sections, questions, etc. Questions are presented in sections. There's one layout for each type of expected answer (text, multiple choice, check box). Fields on these layouts are globals. "Forward" and "Back" buttons allow them to move between sections. As they move to a section, any answers stored in the Answers table are put in the globals. When they leave a section, their latest answers are copied from the globals to the Answers table. (I know I'm bucking a trend here, but I use repeating fields to store both the questions and answers for each section. They can have up to 20 sections in a form, and 25 question/answer pairs within each section. So each table has 20 repeating fields, each with 25 repetitions.)

               

              This was originally created for use in FileMaker, but most forms are now filled out on the web using CWP. That transition actually wasn't too bad. On the web, there obviously aren't layouts for each type of expected answer, but instead it builds the <INPUT> statements for each question/answer based on the info in Questions. Form definition and review/reporting are still done in FileMaker.

               

              I think you could build the branching you need into the Questions table, or possibly a set up a related Subquestions table where the relationship is dependen t on their answers to specific questions.

               

              HTH,

              Julie