Add form elements dynamically

Add form elements dynamically


We use OutSystems 9.0.1 for our implementations. One requirement we have is to be able to dynamically add new form elements. The flow - 
1. Customer enters some personal details and submits form
2. Our application connects to multiple web services which validate/process the customer details
3, The web services may require further details to be returned - they respond back with a list of fields that require values from the customer. These fields may be either text, numeric or date-time types. 
4. We are expected to display these fields on the form with appropriate wisgets and prompt the user to enter values for these

Any recommendation on the approach to achieve this functionality?
The most direct approach would be to create a list of structures that supports the possible values for those fields, from the web service's returned values.

Something along the lines of
MyFormField {

You would then list the returned fields and display a different input according to the FieldType. I think the survey app that's available here contains something along those lines.

That being said, the resulting user experience would probably be very poor, since you're relying on the web service to validate all the business logic. If some of the fields need to be filled-in with values that are dependant on other fields, a user would probably get frustrated by the lack of assistance your app would provide.

So, what's my recommendation? Unless the form's fields change very very often, you'd be better off building static forms, implementing the business validations in your app and changing it when the business logic changes, or when new fields are added. Changing a form in the Outsystems platform is trivial, so leverage that.