unable to run validation when validate.as.you.type option is ser to false.

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
ganem2
Posts: 21
Joined: Wed Jun 29, 2022 8:49 am

unable to run validation when validate.as.you.type option is ser to false.

Post by ganem2 »

Hi Team,

When i set 'validate.as.you.type option' to false in web author Validation Results panel is not rendered. As per the description of this option it is used to turn off the automatic validation.
I have similar use case where we need to run validation when user needs it. but with this option set to false, I do not see any tool bar button/shortcut to run validation.

I tried to run the validation task manually by creating custom plugin. sample code below. but this does not bring back the validation results right panel. Is there a way to include a button to run validation on demand?

Code: Select all

@Override
public String doOperation(AuthorDocumentModel model, ArgumentsMap args)	throws IllegalArgumentException, AuthorOperationException {
	try {
		model.getDocumentValidator().getValidationTask().call();
	} catch (Exception e) {
		log.error("Exception while performing manual validation", e);
	}
}
mihaela
Posts: 504
Joined: Wed May 20, 2009 2:40 pm

Re: unable to run validation when validate.as.you.type option is ser to false.

Post by mihaela »

Hello,

First of all, we want to better understand your use case. Can you please give us more details about why you disabled the automatic validation and want to enable manual validation? Did you encounter a problem regarding the automatic validation?

There is an issue registered in our internal issues tracking system to add a "manual validation" action if the automatic validation is disabled. I added your vote for it and we will update this thread when this feature will be available.

Regarding your code, the action that you created just starts the validation process, which returns a list of validation results. It does not show the Validation panel. What you can do is include the list of validation errors in the operation result and then display a custom view [1] or dialog [2] to the user to show the results.

[1] https://www.oxygenxml.com/maven/com/oxy ... mview.html
[2] https://www.oxygenxml.com/maven/com/oxy ... ialog.html

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
ganem2
Posts: 21
Joined: Wed Jun 29, 2022 8:49 am

Re: unable to run validation when validate.as.you.type option is ser to false.

Post by ganem2 »

Hi,
Our editors use web author to edit, validate and correct huge xml files. we have 100's of schematron and custom complex validations in place to ensure data validity. In most of xml's we get more than 100 errors and warnings before its corrected. below are the challenges we are facing with auto validation.
1. Auto validation is executed for each change done, which means 100's of rules executed for each change users make in editor. creates load on our servers.
1. Editors need to keep track of errors corrected in xml. Auto validation errors will be removed from list after correcting data. which force editors to copy errorsto notepad for tracking.
2. validation takes up 2-5 seconds depending on no of errors to return result. any changes made during this time also trigger validation and validation results always lag behind affecting editors' productivity.
3. In some cases based on geo location we face network lag that adds up additional delay making user experience not much pleasant.

Manual validation will resolve the above issues.
1. Editors can run it once in beginning and once after correcting data reducing unnecessary load on servers.
2. Easier to keep track of errors.
3. Editors in control of when validation is run, means no more lags and that makes user experience pleasant.
mihaela
Posts: 504
Joined: Wed May 20, 2009 2:40 pm

Re: unable to run validation when validate.as.you.type option is ser to false.

Post by mihaela »

Hi,

Thank you for all the details, we now better understand your use case. The part that we want to understand more is:
Editors need to keep track of errors corrected in xml. Auto validation errors will be removed from list after correcting data. which force editors to copy errors to notepad for tracking.
Why do you need to copy the errors that are fixed? And how do you plan to associate the fix (the change in the document) with the source error?

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
ganem2
Posts: 21
Joined: Wed Jun 29, 2022 8:49 am

Re: unable to run validation when validate.as.you.type option is ser to false.

Post by ganem2 »

Hi Team,
Error tracking is part of the billable implementation. For each document modified or corrected editors keep track of preexisting error to differentiate efforts between data corrected and value added to documents.
Bogdan Dumitru
Site Admin
Posts: 163
Joined: Tue Mar 20, 2018 5:28 pm

Re: unable to run validation when validate.as.you.type option is ser to false.

Post by Bogdan Dumitru »

Hello,

Thank you for sharing with us your interesting use case.
So, if we understood correctly, you want to keep track of the validation errors that each save solves.

Web Author has an API that allows you to add only a listener only for saving but it doesn't have one for autosave. So, in theory, you can intercept when the document is saved but not when is autosaved. See the listener used in the web-author-block-save-if-invalid sample plugin that blocks save if the document has validation errors.

Unfortunately, Web Author is not quite fit for your use case where you want to keep track of validation errors for each revision. The Web Author's validation support and Web Author's API was designed for editors, with editor-related use cases in mind but your use case is not quite editing-related. With the current API, you can filter validation errors, see the ValidationProblemsFilter API, but it doesn't help much either. Considering that you may want automatic problem tracking complicates the matter even more.

We think that your use case would be better implemented post-save, not prior. We think that you can achieve your use case easily and naturally by using Oxygen Scripting, more precisely the validation capabilities from Oxygen Scripting, see this and this. Let's say, for example, if you're using GitHub you can define a GitHub Action (see this) that runs a script by using Oxygen Scripting, processes the output and can comment on the Pull Request with the validation problems that the Pull Request resolves.
Bogdan Dumitru
http://www.oxygenxml.com
Post Reply