Solved

Field validator expression.

Posted on 2007-03-27
1
207 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
1 Comment
 
LVL 35

Accepted Solution

by:
mrichmon earned 500 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

17 Experts available now in Live!

Get 1:1 Help Now