capturetheflag
asked on
Credit card java script file will not validate card number on form
Hello,
I am calling a java script function to validate a card number but it will not validate.
All of the other fields will validate or throw an error except for the credit card number field.
The code to validate the card is below. I have attached the html and other js files in text format to this question. Thanks for the help
popcorn-JS.txt
creditcard-JS.txt
popcorn-CSS.txt
I am calling a java script function to validate a card number but it will not validate.
All of the other fields will validate or throw an error except for the credit card number field.
The code to validate the card is below. I have attached the html and other js files in text format to this question. Thanks for the help
// Validate that the Credit Card :
if (checkCreditCard(cardnumber, cardname)) {
removeErrorMessage('cardnumber');
} else {
addErrorMessage('cardnumber', 'Credit Card Number is not valid.');
error = true;
}
popcorn-HTML.txtpopcorn-JS.txt
creditcard-JS.txt
popcorn-CSS.txt
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW: you may need something other than .value for cardname, also "mc" != "mastercard".
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In the getRadioValue function, try first to replace the '' value assigned to the unchecked case with Null or better to another conventional flag value that may avoid trouble in passing it as a string or value in other functions.
ASKER
Thanks for the help.
capturetheflag, thanks for the points. There is a diverse group of answers here. Did you come up with a good answer for this or did you just want to close it out?