I want to be able to validate a credit card number, card type and expiry date on a form. Note, I am a complete Javascript novice.
I have found a script at <!-- m --><a class="postlink" href="http://javascript.about.com/library/scripts/blccvalid.htm">http://javascript.about.com/library/scr ... cvalid.htm</a><!-- m --> which does all I need but would prefer to use onSubmit rather than onClick to call it so I can incorporate a number of other validation routines.
I changed the onClick to onSubmit and moved it to the <form> line and it seems to do the checks OK but continues on to perform the form action rather than set focus back at the offending field.
Can anyone help me to get this working the way I want?
I have found a script at <!-- m --><a class="postlink" href="http://javascript.about.com/library/scripts/blccvalid.htm">http://javascript.about.com/library/scr ... cvalid.htm</a><!-- m --> which does all I need but would prefer to use onSubmit rather than onClick to call it so I can incorporate a number of other validation routines.
I changed the onClick to onSubmit and moved it to the <form> line and it seems to do the checks OK but continues on to perform the form action rather than set focus back at the offending field.
Can anyone help me to get this working the way I want?