Type: New Feature
Status: Code Review (Post-Commit)
Affects Version/s: None
Fix Version/s: None
The UI Framework's UiUtils.includeFragment(..) allows to embed GSP components at will, and this can be done in HFE forms as well. However it is not possible as of now to "connect" the included GSP component to the saving process of one (or multiple) obs.
This ticket will look at designing a mechanism to capture a well targeted input recorded through the fragment, so that this specific input is saved as an obs.
The workflow would be as such:
- The fragment is included in the form.
- The user uses the fragment to key in values.
For instance to key in a date with when a date picker fragment is included, to key in a location name when a location selector is included... etc.
- The tag handler would obtain the target value (a date, a location name, ... etc) from the fragment's HTML and save it as an obs.
We will introduce a new <obsFromFragment/> tag as such:
- conceptId is the concept for the obs, in particular its data type will drive the obs type as it happens with the <obs/> tag.
- provider, fragment and fragmentParams are the usual arguments for UiUtils.includeFragment(..).
- fragmentParams should reference formFieldName, the name of the form's input field that we target (when there is only one.)
The idea is to
- Use the value of formFieldName to locate the target input field.
- The input field should be an <input/> HTML element (TBC).
- Save that value as an obs of the provided concept.
- For cases were the same concept is used more than once on the same form ie. Like in two <obsFromFragment/> tags, this implies that more than one Obs will be linked to the same concept. Now this is normally fine depending to the context of use but for our usecase it's not. The issue will be guessing which <obsFromFragment/> widget owned which Obs value since it's the concept driving the tag. We solved this by simply setting the formFieldName of the widget as it's Obs comment. This helps to map Observations to their widgets!
This would configure UI Commons' field/datetimepicker fragment to be the source for a date value that should be saved as date-time obs based on concept CIEL:1190.