JQuery unobtrusive validation not working on switch

I have the following markup:

<input id="davcardholder-yes" data-val="true" data-val-required="The CustomerDVACardHolder field is required." name="CustomerDVACardHolder" type="radio" value="Yes"> <label for="davcardholder-yes"><span></span>&nbsp; Yes &nbsp; &nbsp; &nbsp;</label> <input id="davcardholder-no" name="CustomerDVACardHolder" type="radio" value="No"> <label for="davcardholder-no"><span></span>&nbsp; No &nbsp; &nbsp; &nbsp;</label> 

And in another place:

 <input data-val="true" data-val-required="The CustomerFirstName field is required." id="CustomerFirstName" name="CustomerFirstName" type="text" value=""> 

jQuery unobtrusive validation works for the latter, but not the first, that is, it does not work for switches.

This is not a display problem - it actually allows the form to be submitted and does not add the input-validation-error class to the first switch.

Does anyone know what could be causing this? Using jQuery 1.8, jQuery validates 1.11.1 and jQuery is unobtrusive (no version). Thanks!

+4
source share

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


All Articles