Solved

Credit card date validation

Posted on 2009-04-11
2
746 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
[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
2 Comments
 
LVL 18

Accepted Solution

by:
Ajay Sharma earned 500 total points
ID: 24124722
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
ID: 31569196
Thanks, this is actually what I started out with but, I had my syntax wrong.  Thanks for your help.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

624 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