Create a Dynamic Form Builder with existing JSON database design

Create a Dynamic Form Builder with existing JSON database design

  

We have a project to build a dynamic form builder in Outsystems - with a twist, we have the form viewer and API in production already, the form is store as JSON in the db & the JSON format is different for each question type.

Here is a more detailed explanation of the problem: https://docs.google.com/document/d/11ClABx3NWyavlqJ_7OYnALqNH7WHk6X-NuJLthVRWJ8/edit?usp=sharing

We have tried to build a prototype in Outsystems in a not usual "Outsystems way" (Use Javascript only). Looking for advises and alternatives to build it nicely.

Hi Jecelyn,

Your Form Viewer is not an OutSystems application correct? Any particular reason why you want the form builder to be one? It seems to me this is a process that you can do without server intervention (you did it purely in Javascript already, so why the need for a platform like OutSystems?

That being said, if it does make sense to implement this in OutSystems, it boils down to modelling your problem correctly, something vaguely resembling this:

  • Form
    • List of Questions
      • Has an "Id" (I'd call it a description or text)
      • Can be Mandatory
      • Has an AnswerType
      • Depending on type may have a bunch of other attributes filled (how to implement this depends on how extensible you need it)
    • AnswerType
      • Static entity that describes possibilities
    • AnswerTypeSpecificTypeDetails (for instance "QuestionDropDownOption")
      • provides details to render answers (for instance, value of a particular option in a dropdown) for a specific Question (you will want to instantiate these depending on what AnswerType you chose for the Question).
    • ValidationRule
      • Static entity that describes possibilities
    • ValidationRuleInstance
      • for a Particular Question, define a Validation Rule and configure values needed to enforce validation (value of "Min" for instance)

Then generate your JSON based on this. You have a RecordListToJSON tool that maybe you can leverage.

But all this only makes sense if you want to use a database to store these form definitions and manipulate them afterwards...

Jorge Martins wrote:

Hi Jecelyn,

Your Form Viewer is not an OutSystems application correct? Any particular reason why you want the form builder to be one? It seems to me this is a process that you can do without server intervention (you did it purely in Javascript already, so why the need for a platform like OutSystems?

That being said, if it does make sense to implement this in OutSystems, it boils down to modelling your problem correctly, something vaguely resembling this:

  • Form
    • List of Questions
      • Has an "Id" (I'd call it a description or text)
      • Can be Mandatory
      • Has an AnswerType
      • Depending on type may have a bunch of other attributes filled (how to implement this depends on how extensible you need it)
    • AnswerType
      • Static entity that describes possibilities
    • AnswerTypeSpecificTypeDetails (for instance "QuestionDropDownOption")
      • provides details to render answers (for instance, value of a particular option in a dropdown) for a specific Question (you will want to instantiate these depending on what AnswerType you chose for the Question).
    • ValidationRule
      • Static entity that describes possibilities
    • ValidationRuleInstance
      • for a Particular Question, define a Validation Rule and configure values needed to enforce validation (value of "Min" for instance)

Then generate your JSON based on this. You have a RecordListToJSON tool that maybe you can leverage.

But all this only makes sense if you want to use a database to store these form definitions and manipulate them afterwards...

It's because it's the company direction to move towards using Outsystems for new projects...