When the xpath throws a validation error the web-forms UI displays the error in a dialog that is impossible to recover from without refreshing the form.
We can't necessarily show an error beside the field because it may be that it's not shown to the user, or the xpath expression may reference several fields. Instead show an error at the top of the form, and disable submit. That way the user is not blocked from fixing the error, and not interrupted if they're in the process of providing valid data.
Also consider if throwing errors is the correct approach or if the API should instead return error objects.
There may be a common approach that can be used for similar errors in the xforms-engine.
When the xpath throws a validation error the web-forms UI displays the error in a dialog that is impossible to recover from without refreshing the form.
We can't necessarily show an error beside the field because it may be that it's not shown to the user, or the xpath expression may reference several fields. Instead show an error at the top of the form, and disable submit. That way the user is not blocked from fixing the error, and not interrupted if they're in the process of providing valid data.
Also consider if throwing errors is the correct approach or if the API should instead return error objects.
There may be a common approach that can be used for similar errors in the xforms-engine.