Solved

Field validator expression.

Posted on 2007-03-27
1
212 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

840 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