Files
Last update 2 months 4 days
by
Arnaud-Apu-Fanovard
conditional-validation.js.téléchargement$.validator.addMethod("requiredif",function(e,t,n){var i="#"+n.dependentproperty,s=n.targetvalue,s=(s??"").toString(),o=$(i),a=o.attr("type"),r=a==="checkbox"?o.attr("checked").toString():o.val();return s.toLowerCase()!==r.toLowerCase()||$.validator.methods.required.call(this,e,t,n)}),$.validator.unobtrusive.adapters.add("requiredif",["dependentproperty","targetvalue"],function(e){e.rules.requiredif={dependentproperty:e.params.dependentproperty,targetvalue:e.params.targetvalue},e.messages.requiredif=e.message,e.element.hasAttribute("required")&&(e.messages.required=e.message)}),$.validator.addMethod("enforcetrue",function(e,t){return t.checked}),$.validator.unobtrusive.adapters.addBool("enforcetrue")