Since 1.11.x, the Obs tag has as "form_namespace_and_path" field, which is intended to support recording the form and field that an obs came from. Having this support would allow us to directly map an obs to an HTML form entry field when editing a form, overcoming limitations like those mentioned in
In https://issues.openmrs.org/browse/HTML-742 the condition tag was updated to support a "formPath" parameter.
For this ticket, we should update the Obs tag to support this as well. If a obs tag has a "formPath" parameter, this should be the first way that is used to try to match existing obs to a form when opening in edit mode.
Also see related Talk post: https://talk.openmrs.org/t/hfe-conditions-should-have-a-pointer-for-the-form-field-it-was-created-through/29110
Will need a little design, but it's possible that this will be relatively straightforward...
Some tech notes:
- For backwards compatibility, will still need to be able to match obs without a form_namespace_and_path value to obs field that have a formPath attribute
- However, I don't think we have to support the reverse use case.... that is, if a obs has a value for form_namespace_and_path, don't ever match it to a form element that doesn't have that formPath associated with it certainly if it has a non-matching namespace and path?