Solved

Client-side validation of credit cards in Virtuemart

Posted on 2011-09-08
8
679 Views
Last Modified: 2013-12-13
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.

Thanks
0
Comment
Question by:usnow2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 13

Expert Comment

by:joomla_php
ID: 36507355
So you don't want to wait for server validation, you're trying to catch it on client side?
0
 

Author Comment

by:usnow2
ID: 36507400
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.
0
 
LVL 13

Expert Comment

by:joomla_php
ID: 36507478
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:
http://www.google.com/search?q=javascript+validate+credit+card+form&sourceid=ie7&rls=com.microsoft:en-us:IE-Address&ie=&oe=

Where to add the code:
components/com_virtuemart/themes/default/templates/checkout/list_payment_methods.tpl.php line 24
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:usnow2
ID: 36507534
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?
0
 
LVL 13

Expert Comment

by:joomla_php
ID: 36507639
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.
0
 

Author Comment

by:usnow2
ID: 36507820
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
0
 
LVL 13

Accepted Solution

by:
joomla_php earned 250 total points
ID: 36507847
you are correct.
0
 

Author Comment

by:usnow2
ID: 36542332
Thanks, those were the pages in which I was able to add my custom validation code.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
Invest in your employees with these five simple steps to improve employee engagement and retention.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question