Solved

Client-side validation of credit cards in Virtuemart

Posted on 2011-09-08
8
691 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
More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

 

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

PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

617 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