I have some inputs using the chosen plugin that I want to validate as \"required\" on the client side. Since \"chosen\" hides the actual select e
@Anupal put me on the right path but somehow I needed a complex fix
.chosen
to be consideredjavascript
$.validator.setDefaults({ ignore: ":hidden:not(.chosen)" })
Or any other name you give to your chosen's. This is global configuration. Consider setting on top level
Thanks to BenG
html
javascript
Again, global configuration for $.validator
object. Can be put next to the previous command
$.validator.addMethod('chosen-required', function (value, element, requiredValue) {
return requiredValue == false || element.value != '';
}, $.validator.messages.required);