Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Field validator expression.

Posted on 2007-03-27
1
Medium Priority
?
222 Views
Last Modified: 2010-04-16
Required field validator. YYYYMM

Numbers only has to be a period.
of type numeric for example 200701


0
Comment
Question by:mathieu_cupryk
[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
1 Comment
 
LVL 35

Accepted Solution

by:
mrichmon earned 2000 total points
ID: 18803278
<asp:requiredfieldvalidator runat="server" controltovalidate="yourfield" errormessage="Please enter this value in the format YYYYMM" display="dynamic" />
<asp:regularexpressionvalidator runat="server" controltovalidate="yourfield"  validationexpression="[0-9]{6}" errormessage="Please enter this value in the format YYYYMM" display="dynamic" />

But that does allow 000701

If you want to restrict the years you need a more complex validation expression like:

[1-2][0-9]{3}(0[1-9]|11|12)

which makes the year start with a 1 or 2 followed by 3 digits and a valid month
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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