Solved

Credit card date validation

Posted on 2009-04-11
2
727 Views
Last Modified: 2012-05-06
Hello everyone,

I have been looking for days for a good solution to this and have had no luck.  What I want to do is simply use an ASP.net validator (probably regular expression validator) to validate a credit card expiration date in the format of (MM/YYYY) on the client side. Does anyone have any ideas of how to implement this.  If there is no way to use an ASP.net validator for this, does anyone know of a good javascript to use?  
Thanks

Jay  
0
Comment
Question by:jwoodhams
2 Comments
 
LVL 18

Accepted Solution

by:
Ajay Sharma earned 500 total points
Comment Utility
Use Regex:

^((0[1-9])|(1[0-2]))\/(\d{4})$

The above regex code calculates only the month and year. It can not evaluate that if the date is less then today or not.

Also read http://www.codeproject.com/KB/validation/creditcardvalidator.aspx

For more complex conditions use custom validator.

Resources for custom validator:

http://asp.net-tutorials.com/validation/custom-validator/

http://www.4guysfromrolla.com/articles/073102-1.aspx

http://www.w3schools.com/ASPNET/showasp.asp?filename=demo_customvalidator

0
 
LVL 1

Author Closing Comment

by:jwoodhams
Comment Utility
Thanks, this is actually what I started out with but, I had my syntax wrong.  Thanks for your help.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

16 Experts available now in Live!

Get 1:1 Help Now