disable the button when form is not validated.
A similar question was asked before. It says it's solved but what exactly was the decent solution? Did I miss something?
Form validation documentation page is broken it has markdown errors.
A similar question was asked before. It says it's solved but what exactly was the decent solution? Did I miss something?
Form validation documentation page is broken it has markdown errors.
I answered the other question.
I have also updated your playground.
Add a @propertyValidated="onValidateForm"
event listener that triggers on each validation.
Then you can use hasValidationErrors()
on the form to see if the form is valid. The only trick is that is has to be wrapped in a setTimeout()
, like so:
onValidateForm(event) {
setTimeout(() => {
this.validated = !event.object.hasValidationErrors();
console.log("form valid: " + this.validated);
}, 100);
}
For a complete solution, see this {N} Playground.