Solved

Client-side validation of credit cards in Virtuemart

Posted on 2011-09-08
8
664 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
  • 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
 

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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Let’s list some of the technologies that enable smooth teleworking. 
The viewer will learn how to count occurrences of each item in an array.
Viewers will learn how to use the Hootsuite Dashboard.

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now