You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything seems to work great with the validation annotations on the view model. However, I am having issues when, on the server-side (after a form post), I do some additional validations and add modelstate errors. Those errors actually render appropriately and come through in the response from the server, however, the errors that are associated with one of the properties/inputs on the form, those end up getting cleared out some how. Now, if I put the validation summary on the page, the message does show there, but the message related directly to the input doesn't show and the input isn't marked as invalid any longer. Any idea on what might be going on?
I'm using jQuery v2.1.4, jQuery Validation v1.14.0, jQuery Validation Unobtrusive v3.2.6, Bootstrap 4.4.1, and I am using your plugin v2.2.0.
the server-side add model error statement: this.ModelState.AddModelError(nameof(LoginViewModel.Email), "Your account has been disabled.");
the response as it came from the server to the client:
<div class="form-group">
<label class="control-label" for="Email">Email Address</label>
<input class="form-control input-validation-error" type="email" autocomplete="off" autofocus="true" data-val="true" data-val-required="The Email Address field is required." id="Email" name="Email" value="[email protected]" />
_<span class="invalid-feedback field-validation-error" data-valmsg-for="Email" data-valmsg-replace="true">Your account has been disabled.</span>_
</div>
This is from an inspection of the page after the page shows in the browser. As you can see the validation message that came from the server is gone and the input is cleared of the error:
Everything seems to work great with the validation annotations on the view model. However, I am having issues when, on the server-side (after a form post), I do some additional validations and add modelstate errors. Those errors actually render appropriately and come through in the response from the server, however, the errors that are associated with one of the properties/inputs on the form, those end up getting cleared out some how. Now, if I put the validation summary on the page, the message does show there, but the message related directly to the input doesn't show and the input isn't marked as invalid any longer. Any idea on what might be going on?
I'm using jQuery v2.1.4, jQuery Validation v1.14.0, jQuery Validation Unobtrusive v3.2.6, Bootstrap 4.4.1, and I am using your plugin v2.2.0.
the cshtml setup:
the server-side add model error statement:
this.ModelState.AddModelError(nameof(LoginViewModel.Email), "Your account has been disabled.");
the response as it came from the server to the client:
This is from an inspection of the page after the page shows in the browser. As you can see the validation message that came from the server is gone and the input is cleared of the error:
The text was updated successfully, but these errors were encountered: