473,545 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regular Expression Validator and RequiredFieldVa lidator ???

I have the following problem.
I am using the follwing Regular Expression validator(REV) with validator expressions
^[0-9]{1,2}$
^[a-zA-Z0-9]{3,20}$
The idea of the first exp is 1 or 2 digits
the idea of second expression is username between 3 and 20 chars

When the user enters characters other than the specified REVs are working.
But if the user leaves the textbox without entering anything
Page.IsValid is true which indicates it is not performng any validation.

I read that {n,m} syntax in .net regular expressions is min(n)-max(m)
in the documentation.

Should i also use ReguiredFieldVa lidator
in addition to regular expression validator

any one facing the same problem.

where is the mistake in me or in .net
Nov 18 '05 #1
2 5564
Hi, S.Kartikeyan,

Yes, you should use a combination of RegularExpressi onValidatior and a
RequiredFieldVa lidator in order to prevent the user from leaving the
associated control blank.

It is mentioned in the Note in the Remarks section:

http://msdn.microsoft.com/library/en...ClassTopic.asp

Greetings
Martin
"S.Kartikey an" <in*******@yaho o.com> wrote in message
news:6d******** *************** ***@posting.goo gle.com...
I have the following problem.
I am using the follwing Regular Expression validator(REV) with validator expressions ^[0-9]{1,2}$
^[a-zA-Z0-9]{3,20}$
The idea of the first exp is 1 or 2 digits
the idea of second expression is username between 3 and 20 chars

When the user enters characters other than the specified REVs are working.
But if the user leaves the textbox without entering anything
Page.IsValid is true which indicates it is not performng any validation.

I read that {n,m} syntax in .net regular expressions is min(n)-max(m)
in the documentation.

Should i also use ReguiredFieldVa lidator
in addition to regular expression validator

any one facing the same problem.

where is the mistake in me or in .net

Nov 18 '05 #2
Thanks For your help.
I was wondering where is the mistake.
Microsoft should have designed it the otherway which is more intuitive.

S.Kartikeyan

"Martin Dechev" <de*******@hotm ail.com> wrote in message news:<Oc******* *******@TK2MSFT NGP12.phx.gbl>. ..
Hi, S.Kartikeyan,

Yes, you should use a combination of RegularExpressi onValidatior and a
RequiredFieldVa lidator in order to prevent the user from leaving the
associated control blank.

It is mentioned in the Note in the Remarks section:

http://msdn.microsoft.com/library/en...ClassTopic.asp

Greetings
Martin
"S.Kartikey an" <in*******@yaho o.com> wrote in message
news:6d******** *************** ***@posting.goo gle.com...
I have the following problem.
I am using the follwing Regular Expression validator(REV) with validator

expressions
^[0-9]{1,2}$
^[a-zA-Z0-9]{3,20}$
The idea of the first exp is 1 or 2 digits
the idea of second expression is username between 3 and 20 chars

When the user enters characters other than the specified REVs are working.
But if the user leaves the textbox without entering anything
Page.IsValid is true which indicates it is not performng any validation.

I read that {n,m} syntax in .net regular expressions is min(n)-max(m)
in the documentation.

Should i also use ReguiredFieldVa lidator
in addition to regular expression validator

any one facing the same problem.

where is the mistake in me or in .net

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2937
by: VSK | last post by:
Hi all, I have a .ascx file with dropdownbox (SSN, EmpName) textbox submit button regular expression validator( controltovalidate is the above textbox) Now i want to change the Regular Expression of the validator based on the
2
2247
by: Nazir | last post by:
Hi I'm using a regular expression validator, but if spaces are entered, it bypasses the validation! I'm using ^{5,100}$
2
9848
by: Dot net work | last post by:
Hello. Say I have a .net textbox that uses a .net regularexpressionvalidator. If the regular expression fails, is it possible to launch a small client side javascript function to do something, such as change the border color of the textbox to red? That would look quite nice: if the expression fails, the red validator text is shown, plus...
4
1253
by: Daniel | last post by:
I would like to get some help on regular expression to validate decimal numbers. It should also match negative value, empty value. The expression: ^(\-){0,1}({1}{0,8}(\,{3})*(\.{0,8})?|{1}{0,}(\.{0,8})?|0(\.{0,8})?|(\.{1,8})?)$ is doing this job, but matches a single hyphen "-" also. For example: matches -12.34 but also matches - I...
2
488
by: Scott Natwick | last post by:
Can anyone suggest a good reference for Regular Expressions? Or more specifically, I need to check that a user has made a selection from Drop Down List. The default in my Drop Down List is "". I need a Regular Expression to trigger if this default value has not changed. Any ideas? Thanks in advance, Scott Natwick
5
4462
by: John . | last post by:
I am using the Regular Expression Validator control to validate a correct email address. But, at the same time I would like to make it a required field. I tested by using just the regular expression validator expecting a message to be displayed but it let me submit the form. Do I have to use both?
2
1390
by: kieran | last post by:
Hi, I am using Visual Studio 2005 and am trying to use a Regular Expression Validator control. I have a drop down list which contains various names, the first one is "Please Select". I want the user to have to select a name other than 'Please Select'. I am thinking maybe the Regular Expression Validator is the best move
3
5336
by: CK | last post by:
Hello All, I have a page with a text box. It has a required field validator, and a regualur expression validator tied to it. A valid email is required. When clientside is enabled it works great. When it's disabled the server side validation works for the required field, but the server side doesn't work for the regEx validator. Any ideas?...
6
7941
by: David | last post by:
I'm having trouble getting the regular expression validator to work with a text box. In this simple example I only want lower case letters to be allowed. So I tried the following and it doesn't work, would somebody be so kind as to tell me why. <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:RequiredFieldValidator...
0
7490
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7682
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7449
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7780
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.