I want to edit my form and add new field and variables dynamically, I tried this code:
function _btnAddElement(event) {
var __sForm = event.getFormName();
application.output(__sForm);
var _form = solutionModel.getForm(__sForm);
var _varTextFiled2 = _form.newFormVariable('variabile',JSVariable.TEXT);
_varTextFiled2.defaultValue = '"Ciao"';
_varTextFiled2.variableType = JSVariable.TEXT;
var field2 = _form.newField(_varTextFiled2,JSField.TEXT_FIELD,2,300,200,25);
controller.recreateUI();
}
but in this way i create a new field but it isn’t associated to the new variable, I think that the problem is the controller.recreateUI() it re-create only the GUI.