I am in the process of creating a form that offers 3 different payment options:
1 - Direct Deposit
2 - Credit Card
3 - Cash at Office
The issue I am facing is with the validation of input fields for Credit Cards. I want to make it so that these fields are not mandatory if the user does not select Credit Card as their payment method. This way, the form can be submitted without this information if it's not needed.
Any suggestions on how to achieve this? You can view my current setup on JSfiddle: http://jsfiddle.net/barmar/Kvg8M/2/
Here is the JavaScript code I have implemented:
$(document).ready(function () {
$(".paymentmethod").click(function () {
$(".paymentinfo").hide();
switch ($(this).val()) {
case "Direct Deposit":
$("#pay0").show("slow");
break;
case "Credit Card Authorisation":
$("#pay1").show("slow");
break;
case "Cash at FAA Office (In Person)":
$("#pay2").show("slow");
break;
}
});
});
I am also using Adobe Business Catalyst for this project. Any tips or advice related to this platform would be appreciated!