How to disable button when RadDataForm is not validated?

100 Views Asked by At

disable the button when form is not validated.

{N} Playground

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.

2

There are 2 best solutions below

1
Tiago A. On BEST ANSWER

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.

1
Ian MacDonald On

I answered the other question.

I have also updated your playground.