Solved

Client-side validation of credit cards in Virtuemart

Posted on 2011-09-08
8
658 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.
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…

758 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

23 Experts available now in Live!

Get 1:1 Help Now