Client-side validation of credit cards in Virtuemart

I am trying to write some code that will validate the information for processing a credit card payment in Virtuemart.

At the very least I want to validate or prevent the following:
- Entering an expiration date older than today.
- A security code containing more than three digits or characters.

Any ideas or pointers will be welcome.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

So you don't want to wait for server validation, you're trying to catch it on client side?
usnow2Author Commented:
Yes, I want to prevent displaying useless information to the user and forcing them to go back in the checkout process and fixing the information previously entered.  Virtuemarts' server-side validation will thus only take place if the client-side validation succeeds and the form is submitted.
This might be less than you're looking for but an actual answer would take a pretty long time to write.

Scripts to do the validation:

Where to add the code:
components/com_virtuemart/themes/default/templates/checkout/list_payment_methods.tpl.php line 24
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

usnow2Author Commented:
Thanks, I of course didn't mean that you have to generate all the code :)

The file reference you mention above however is one part of the puzzle.  I'm also looking for the file where the form is being opened.  Do you know in which file the opening form tag for this form will be located?
I'm pretty sure it's
      components/com_virtuemart/html/checkout_index.php line 271
appears to be a javascript submit being tagged on at line 354.
usnow2Author Commented:
I'll check to see if I can get a solution working a bit later, just wanted to mention that the file above should be: ADMINSTRATOR/components/com_virtuemart/html/checkout_index.php
you are correct.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
usnow2Author Commented:
Thanks, those were the pages in which I was able to add my custom validation code.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.