Custom validation without Schematron
Posted: Tue Mar 12, 2024 4:15 pm
Hello,
I'm trying to implement a validation for the following process:
A request to an external endpoint is made when a document is opened in Author mode to fetch additional information to some custom XML tags. The retrieved content is not inserted in the XML after the request, it is inserted in the HTML just for the user visualization, what makes the use of Schematron not possible. What I'm trying to accomplish is to set an error to an element programmatically when the request is not successful, showing the error in the document validation tab and blocking the user from saving the document. Therefore I wanted the problem to be inserted in an specific moment and to be removed if the node in question is deleted or if the information comes to be retrieved successfully. I tried some workarounds, as using an extension for ValidationProblemsFilter and overriding the "filterValidationProblems" function, but it's not working as expected. Is there an easier way of doing this?
Thanks!
I'm trying to implement a validation for the following process:
A request to an external endpoint is made when a document is opened in Author mode to fetch additional information to some custom XML tags. The retrieved content is not inserted in the XML after the request, it is inserted in the HTML just for the user visualization, what makes the use of Schematron not possible. What I'm trying to accomplish is to set an error to an element programmatically when the request is not successful, showing the error in the document validation tab and blocking the user from saving the document. Therefore I wanted the problem to be inserted in an specific moment and to be removed if the node in question is deleted or if the information comes to be retrieved successfully. I tried some workarounds, as using an extension for ValidationProblemsFilter and overriding the "filterValidationProblems" function, but it's not working as expected. Is there an easier way of doing this?
Thanks!