Open
Description
Perhaps I missed it, but there doesn't seem to be a way to manually check form/field validity such as exists in jQuery Validation (form.validate()
, form.valid()
, etc.). The following method exists in the source:
/**
* Returns a Promise that returns validation result for each and every inputs within the form.
* @param formUID
*/
private getFormValidationTask(formUID: string) {
let formInputUIDs = this.formInputs[formUID];
if (!formInputUIDs || formInputUIDs.length === 0) {
return null;
}
let formValidators: Validator[] = [];
for (let i = 0; i < formInputUIDs.length; i++) {
let inputUID = formInputUIDs[i];
formValidators.push(this.validators[inputUID]);
}
let tasks = formValidators.map(factory => factory());
return Promise.all(tasks).then(result => result.every(e => e));
}
However, it's private and seems to only support automatic validation on submit. In certain scenarios is necessary to handle the submit event manually and check the form validity before proceeding.
Metadata
Metadata
Assignees
Labels
No labels