Creating a dynamic form in Outsystem

Hi,

Please find the below steps

1) I have created a web screen where three fields are there. 

 The first field is Type and also this is combo box(Ex: Text, TextArea, Combo Box)

 Second is Label and third is Size

Once the user enters three values and on click pf create button, the respective input field will be created

For example. User selects Type is Text and Label is Name and size is 200, on click of create button, an input field will be created with type text and label is Name.


2)On click of create button, below input field will be created

3) For showing field, I have used web block

4)  Inside list records, I kept web block. So whenever the new input field is created, it will go and render the web block as well.

5) This is the created web block in the outsystem. Here Label and Input fields are there. Based on what user selects in the type field(Mentioned in step 1), it will render the respective input field since "if" condition is there. 

6) For example, two input fields are created by the user (FirstName and Lastname) with text type. Both are having the same variable(Var1). As per my understanding, a variable can't be assigned to different input fields. So, How can I take those values on click of Save button and insert into the DB.


Kindly help me to solve this issue. I have tried a lot to solve this. But I could not find the solution.

Hi,


first of all, it's not really recommended to do it as such, because there are other tools there which support these kind of dynamic stuff.

In any case, your direction should be more of listrecords/tablerecords and in there you have your inputs..

either with or without webblocks.


There is component in forge which does demonstrate how to generate dynamic forms ( Not exactly the way you tried to implement ) . Have a look at following link some section of code can be reused for your purpose. 


I am sure it will not be exact solution to your problem but it has different approach to render dynamic forms. 

https://www.outsystems.com/forge/component-overview/1999/dynamic-forms


The table used in this example to capture field details  can be populated from input of your form ( needs modification as per your requirement) 




J. wrote:

Hi,


first of all, it's not really recommended to do it as such, because there are other tools there which support these kind of dynamic stuff.

In any case, your direction should be more of listrecords/tablerecords and in there you have your inputs..

either with or without webblocks.


Thanks for your reply. But I want to achieve this in Outsystem without using any extra plugins. But I can use forge component. As of now, there are no forge components except Dynamic Form component and also this is not importable. We have to do from scratch.


Hi Divya,

I assume your entity should have the following columns Id(unique identifier), Type(text, textarea, combo, e.t.c.), Value(text type)

But what you should do is to create another structure with following attributes Id,Type,TextValue,TextAreaValue,ComboValue

Your form's source record should use the structure that you have defined, which should be assigned in Preparation and on save convert the structure back to entitytype and save it.


You may check how i done it here 

Website Form Configurator

br