Several values ​​for the aria described when using jQuery validation. Unobtrusive

I use the latest version of jQuery validation unobtrusive in combination with the latest version of jQuery Validate. Validation itself works like a charm. However, if the field is invalid, the values ​​will be added to the aria-describedby attribute.

Let's say I want to enter my password (for verification, the password must be longer than 6). The initial HTML is as follows:

 <input data-val="true" data-val-minlength="The field Passwort must be a string or array type with a minimum length of '6'." data-val-minlength-min="6" data-val-required="The Passwort field is required." id="Password" name="Password" tabindex="2" type="password"> 

I start entering a password with only 5 characters, and then remove the focus from input by clicking somewhere on the body . Validation is complete and many attributes and values ​​are added, including aria-describedby . Now the aria-describedby attribute has only one Password-error value. If I focus the input field again and delete all the characters and even keep pressing backspace, a new value is added for each key. This leads to the following:

 <input data-val="true" data-val-minlength="The field Passwort must be a string or array type with a minimum length of '6'." data-val-minlength-min="6" data-val-required="The Passwort field is required." id="Password" name="Password" tabindex="2" type="password" aria-required="true" aria-invalid="true" class="input-validation-error" aria-describedby="Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error"> 

This is a pretty overhead for the value for the attribute stating that the values ​​are equal. Is this normal behavior or does anyone know how to fix this?

+6
source share
2 answers

I have no explicit explanation for the problem, but since Visual Studio creates shadow copies in the background, I could solve the problem by clearing cashe and deleting all the shadow files for the project and rebuilding after that.

0
source

This problem was present in jquery.validate.js v1.13.0, but has since been fixed (at least v1.14.0).

+4
source

Source: https://habr.com/ru/post/977489/


All Articles