How can I check for those errors before closing the panel? (if those AddModelErrors happen, don’t stopLoading but don’t close the panel. If everything is fine, stopLoading and close panel)
The second function in .then( will be called instead of the first function
In the phase where you call the stopLoading function, the errors should be in dotvvm.validation.errors array (and all errors will be cleared if it succeeded)
I’ve been trying the second .then() and even catch() but it always run the first then().
How can access errors from “dotvvm.validation.errors” ? I’ve been trying loops and it doesn’t work.
I tried to look in “Access validation errors from JS” documentation page but it’s
empty.
Ah, sorry, it works slightly differently. The postback handlers run in two phases
the request to the server is made, this happens in the callback function. I’ll rename it to next, it is similar to the “call next” logic of AspNetCore middlewares. This throws if we didn’t get any readable reponse (network failure, HTTP 500, …)
commit: the postback changes are applied to the viewmodel. This throws if the changes couldn’t be applied to the viewmodel, for example because of validation errors.