Hello, is it possible to generate a form on the fly?, a part of my app need to let an user define/design his own form, is it posible? I had a similar functionality on an older app, but I want to build this version on a different way, on the previous app function something like this:
The user created a form on a designer app, and saved the info to build the form on a json, and on the code I read the json and created the form when an user opened, something like:
"fields":[
{
"fieldType": "textbox",
"caption": "name",
"value":"",
"enabled":...
},{
"fieldType": "combobox",
"caption": "favorite colors",
"value":"",
"enabled":...
}]
java:
public Component getFormField(FormField info){
Component field
switch (info.getFormFieldType()) {
case textbox:
field = generateTextbox(info);
break;
case Combobox:
field = generateCombobox(info);
..
...
....
case default;
field = null;
}
return field;
}
something like that.
The cons was that I couldn’t add all the attributes that a field could require, only the most common, and I can’t add functions to the form actions on this way, for example, enable/disable fields, or refresh a combo data based on a previous selection of other combo.
I would like to generate a file that I could later edit something like:
myform.html
myform.js
and if the user need to edit a field or add functionality to the form, do it directly to this files obviously without the necessity of restarting the application.