Form Field Validation non-active if fields are hidden
I have created a custom form which is part of an application process and in this form I have a menu field with two options which are: 'SIngle payment' or 'Split payment'. If split payment is selected then it reveals other form fields. I have done this with this small piece of Javascript:
<script>
$('#payment_option').on('change',function(){
if( $(this).val()==="Split"){
$("#split-payment").show()
}
else{
$("#split-payment").hide()
}
});
</script>
if the 'Single Payment' option is selected then the additional form fields are hidden.
Consequently is there a way I can have validation for these fields but only effective when the form fields are visible
I hope this makes sense!