Hi guys, I recently added a custom validator to a dropdown field and would like to add a condition to it so that the validation will not trigger if the value of a certain dropdown list is not Yes. How can I modify my code to add the condition statement?
Here's my code:
<script type="text/javascript">
require([
'jquery', // jquery Library
'jquery/ui', // Jquery UI Library
'jquery/validate', // Jquery Validation Library
'mage/translate' // Magento text translate (Validation message translte as per language)
], function($){
$.validator.addMethod(
'validate-item-duration', function(value) {
return (value > 0);
}, $.mage.__('This is a required field.'));
});
</script>