Hello everyone,
In Froms2.0, when we have a section or obsgroup with add more property and there are form conditions inside them. If we do an add more instead of rendering the original state it is rendering the previous section state.
For example:-
If we add a form condition for "prescribed days" mentioning it should display “missed days” only when some value is entered in “prescribed days”, the expected behavior when we add more is as shown in below picture
Proposed solution:-
Write a method where it executes the whole form conditions script again when we click on add more
and
Should add a control event property for the section level, this is required because when there are multiple form conditions in a section then add more of that section fails to render fresh state
After having a discussion with Angshu we are going ahead to implement it by adding a control event property to section and obsgrp, which will be triggered on mount of section/obsgrp.
for every “container” control (e.g. section, obsgroup etc) - an onload() function will be called on mount of the control
if “add-more” is allowed for the control, and if so clicked on form for a container control - the control.onload() function will be called for the newly added control.
These events are fired only for the control thats being added - and will have no effect or any other event being fired for either the parent control or sibling controls.
After a little more research, we have come to the following solution for add more section form conditions to work properly on render, on click of add more and when rendering with data:
We will create a new api called “getFromParent(‘conceptName’)” - this will get the concept with the given name from the immediate parent of the control.
We will also create "getFromParentById(‘control id’), which will do the same as above, with control id as parameter.
We can come up with a better name for ‘getFromParent’