We are using application.createNewFormInstance() quite extensively now to create multiple instances of our solution. I want to confirm my theory on what this function does because we are also using solution model to make form changes during run-time. Does createNewFormInstance() create a mirror image of the original design form (base form)? We have some forms that make changes to the base form using solution model. Then we use forms.baseForm.controller.recreateUI() and the changes made to the base form seem to automatically update the instance form created through createNewFormInstance() without having to call forms.newInstance.controller.recreateUI. Is my assumption correct?
I also noticed after we switched over to application.createNewFormInstance from solutionModel.cloneForm, that now the events on webClient forms are no longer firing. Not sure how using this function breaks the webClient forms? We are testing more and will create another case tomorrow.
Gary
that clone form issue is fixed for the next beta.
about your createNewFormInstance thats just an extra runtime ui instance of a solutions model form object.
So if you change the solution models form object then those new form ui instances are just the same as a normal ui instance of that form. They should also just be recreated or destroyed/created
It cant be that those ui instances are just showing the changes you made to the solution models form. Thats impossible.
It can be that the stale form check doesnt work for those forms, so you think that it is ok. But in reality they are not up to date with the solutions model form.
Is there a difference in the use of a form between:
application.createNewFormInstance('baseForm', 'targetForm');
and
var _js_baseForm = solutionModel.getForm('baseForm')
var _js_targetForm = solutionModel.newForm('targetForm', _js_baseForm.serverName, _js_baseForm.tableName, _js_baseForm.styleName, false, _js_baseForm.getBodyPart().height, _js_baseForm.width)
_js_targetForm.extendsForm = _js_baseForm
_js_targetForm.useSeparateFoundSet = true // Optional
Yes there is, as far as I know:
application.createNewFormInstance('baseForm', 'targetForm');
does clone a form only in memory, but it won’t be part of the current blueprint of your solution.
trying to get:
solutionModel.getForm('targetForm')
will return ‘null’
var _js_baseForm = solutionModel.getForm('baseForm')
var _js_targetForm = solutionModel.newForm('targetForm', _js_baseForm.serverName, _js_baseForm.tableName, _js_baseForm.styleName, false, _js_baseForm.getBodyPart().height, _js_baseForm.width)
_js_targetForm.extendsForm = _js_baseForm
_js_targetForm.useSeparateFoundSet = true // Optional
Will add a form to the current blueprint of your solution.
It will behave like any other form, with any other code.
The thing you should define is where the “difference” is…
Because the 2 methods do different things, by using the blueprint or not like Mr. Boegem explained
But from an end users perspective, so what the actual result is in a client, there is no much difference, it will see the same thing that also behaves the same.
at runtime the 2 forms both exists. (only not in the solution model)