I created the following dual actions on the button, with the 'show validations' option turned on.
However, if the validation fails, the other actions are still executed on click except for Submit.
I don't want to use the 'Disable on invalid forms' option because it doesn't show me the invalid components.
How do I make sure that all actions are only executed if the validation succeeds?
Hi Muffins
There is an undocumented function you can call called instance.root.checkValidity()
which will return true
if all fields are valid and false
if there are any invalid fields in the response. Using this function, you could conditionally run different parts of your code for example:
instance.emit("submitButton") if(instance.root.checkValidity()){ // Do something }
Hi Muffins
There is an undocumented function you can call called instance.root.checkValidity()
which will return true
if all fields are valid and false
if there are any invalid fields in the response. Using this function, you could conditionally run different parts of your code for example:
instance.emit("submitButton") if(instance.root.checkValidity()){ // Do something }