Please help in solving a solution model Catch 22 problem

I am in a sort of Catch 22 problem (or, this is where I think I am stuck, but most probably I am just doing something wrong). This is the short story: I have to create a solution model form where components are added as needed by the user after the form itself is created and shown. Every time the user wants to add a search field or a combobox he/she presses a button and the components are added, with the associated variables and so on. But, every time a new component is created a ```
forms[‘formname’].controller.recreateUI();


Probably this is more a problem of design strategy rather than just coding (I tried every possible permutation, as far as I know). Is there anyone that could give me a suggestion on how to proceed? Thank you.

Basically - you need to call recreatUI() after EVERY alteration you do (or the user does). This will “update” the model blueprint in memory so that the last change now becomes the “basis” of the form (in memory).

You don’t really need to use the solutionModel to do basic things like changing the foreground color of a button.
Runtime properties will allow you to do that without requiring any recreateUI()

Do you use by any chance solutionModel.revertForm(…) somewhere in your code as well?
Doesn’t that get called by mistake?

(testing what you say didn’t make older added content dissappear - just adding buttons and recreateUI multiple times)

Thanks everybody for the replies and the suggestions. And sorry for replying so late, but I wanted to make some testing. I have now completely rewritten my method and everything now is working: components are built on the fly, foreground colors can be changed without zeroing the contents of field or making components disappear. I think my big mistake was referring to objects using their names, such as forms[‘form_name’].elements[‘element-name’]. A technique that seems to work when the code is linear and straightforward, but fails when there are interwoven references, such as when pressing a button creates some components and changing the value of a field destroy them. So now I modified my solution model code by using everywhere practical the getSomething (form, button, field and so on) method and then operating on the JS object.

By the way, is there a reason why I don’t receive anymore notifications for new forum posts?

Things like forms[‘form_name’].elements[‘element-name’] are runtime elements and things like solutionModel.get… (JSxyz) are equivalent to design-time elements (blueprint as Bob put it).

There is a difference between the two - they can’t be interchanged.
Solution model elements are just like the design time elements that you work with in form designer/developer, while runtime elements are the ones that are really in an instantiated form during runtime (that are created from the blueprint, and can still be customised on the fly but not as much as JS ones).

Hi Andrei,

that’s now perfectly clear. Thank you again.