We need to override the random GUID that gets put into the validation span and replace that with a static field name in our XForms. Each time we refresh an XForm that contains a validation message control, the markup for the validation span changes. Here is some sample markup for a "Name" field.
This field is required
The data-valmsg-for attribute changes each time we refresh the page, appending "Name" with an underscore followed by a new GUID. Here is a piece of the Razor code from InputFragment.cshtml responsible for rendering that span.
The typical Microsoft pattern is to simply make that data-valmsg-for attribute match the ID of the input field. We either need to mirror that default behavior, or permanently prevent that value from changing each time a form gets loaded. The reason for this is we have an external system that regularly scans our published pages to verify that they have not changed, and it is detecting these fluctuating GUID values as unpublished changes.
My initial thought is to simply replace the above Razor with the following wherever it appears in the XForm partials: