usnow2
asked on
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.
Thanks
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
So you don't want to wait for server validation, you're trying to catch it on client side?
ASKER
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:
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/def ault/templ ates/check out/list_p ayment_met hods.tpl.p hp line 24
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/
ASKER
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?
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/check out_index. php line 271
appears to be a javascript submit being tagged on at line 354.
components/com_virtuemart/
appears to be a javascript submit being tagged on at line 354.
ASKER
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/co m_virtuema rt/html/ch eckout_ind ex.php
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, those were the pages in which I was able to add my custom validation code.