[Advanced] Exploring Dynamic Form Structure Generation: Seeking Insights and Solutions

Hello

I’m currently developing a SaaS application where organizations can create customizable forms for their communities. I aim to facilitate the dynamic construction of form structures, intending to store both the form configuration and responses as JSON data.

The forms could vary widely in complexity, ranging from simple text fields to elaborate structures including sections, headers, grouped fields, and more.
For instance, an organization might plan a multi-day training camp and need to collect information on food allergies from participants. Some responses might be straightforward, while others could involve multiple allergies with additional information provided for each.

I did not find any plugin doing this and Googling did not help, so I’m wondering whether this is possible.

One option I’ve considered, albeit seemingly cumbersome, involves using nested repeating group in which I would have all possible input types which would be hidden by conditional rules.

Something like

  • RG Level1
    • RG Level2
      -RG Level3

      Each RG would have all input types with only one visible based on the configuration.

However, this approach feels heavy-handed and potentially inefficient.

Another consideration is integrating with an external form provider, but this would require users to manage their forms on a separate platform, which might not align with the seamless experience I envision for my application.

If anyone has experience with dynamic form creation or suggestions on how to tackle this challenge more effectively, I’d greatly appreciate your input.

Thank you in advance for any assistance you can provide!

Hi @johann3 , I have worked on multiple form builders previously


To display the appropriate question type while previewing the form, I’ve taken the same approach —using nested repeating groups with the relevant question type and show based on conditions. Unless there are many question types, I don’t foresee this causing a significant blocker. Happy to hear in case if you find any other alternative way. Cheers.

Wahouw, it looks impressive.
The challenge I’m facing is to have the ability to generate a subforms.
Example:

  • family name → text
  • first name → text
  • birth date → date
  • allergies → Yes/no, if yes, possibility to add several allergies, each of them being: allergy type (drop down: food/drug/…) + severity (drow down: death risk / …) + how to react (Text)
  • current medication → Yes/no, if yes, possibility to add …

I can see how to use the same as you for the 3 first questions but how to deal with the last 2 ?

Unless I see them as a subForm nested into parentForm, maybe ?
If the answer is yes to “has allergies” → the user can add as many other subforms.

It’s getting complex but I guess that it can be done …

Yes sort of subform setup, as these would not be plain text options to select. I agree, not straightforward but can be built natively.