473,608 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying characters that cause a validator to fail

Hi,
I have a regular expression validator that checks a text box string:

<asp:RegularExp ressionValidato r id="SeqFormat" runat="server"
Display="Static " ErrorMessage="Y our sequence contains illegal characters"
ControlToValida te="Sequence"
ValidationExpre ssion="^[AGTCagtc5678\n\ s]{1,}$">

I'd like to provide the user with a listing of the illegal characters that
triggered a failure of the validator. Do you know how to capture the illegal
characters and display them in a label?
Thanks,
Stephan.

Nov 18 '05 #1
1 1293
Hi Stephan,

This may be a much bigger task than its worth. I have a feeling that
creating an error message telling users what they can type will be far
easier than writing this validator. (FYI: I am the author of "Profession al
Validation And More", a replacement to Microsoft's validators that is
designed to overcome its many limitations. In this case, even I haven't
tackled this thorny issue.)

This is possible if you basically wrote your own validator using their
CustomValidator or subclassing from BaseValidator. Issues you face:
1. While you could still use a regular expression to detect errors, it
wouldn't tell you the invalid characters. You'd still have to loop through
the string and extract unique characters that were illegal.
2. Microsoft's validators were designed with a fixed error message property.
You'd have to update the ErrorMessage property while preserving its original
value. This is especially problematic on the client-side. You would build
your error message string and assign it to the InnerHTML property of the
<span> tag that represents the validator.
3. Remember to write it all both on the client and server sides.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com

"Stephan Bour" <sb***@niaid.ni h.gov> wrote in message
news:BC3582C9.E 135%sb***@niaid .nih.gov...
Hi,
I have a regular expression validator that checks a text box string:

<asp:RegularExp ressionValidato r id="SeqFormat" runat="server"
Display="Static " ErrorMessage="Y our sequence contains illegal characters"
ControlToValida te="Sequence"
ValidationExpre ssion="^[AGTCagtc5678\n\ s]{1,}$">

I'd like to provide the user with a listing of the illegal characters that
triggered a failure of the validator. Do you know how to capture the illegal characters and display them in a label?
Thanks,
Stephan.

Nov 18 '05 #2

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

Similar topics

14
2603
by: Akbar | last post by:
Hey there, Big-time curiosity issue here... Here's the test code (it's not that long)... it's to display a large number of image links with captions, ideally pulled in from an external file (that part's not here -- spotlighting the problem code): --------BEGIN CODE PAGE------------ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
23
3938
by: Brian | last post by:
Despite charset being discussed to death, and despite having followed all of those threads, I still have problems. http://www.tsmchughs.com/recipes/soda-bread This page uses iso-8859-1 charset. From the headers: Content-Type: text/html; charset=iso-8859-1 Under ingredients are characters for fractions (188, 189, and 190) and the degree character (176), characters which Lynx can display on
9
8144
by: Safalra | last post by:
The idea here is relatively simple: a java program (I'm using JDK1.4 if that makes a difference) that loads an HTML file, removes invalid characters (or replaces them in the case of common ones like Microsoft's 'smartquotes'), and outputs the file. The problem is these files will be on disk, so the program won't have the character encoding information from the server. Questions:
33
4755
by: LRW | last post by:
http://gto.ie-studios.net/index.php When you view the above site in IE, if the 1st of the three product images is tall enough to push the cell down a couple of pixels, IE somehow doesn't show that happening. But if you look at it in Firefox you can see the small gap of white where the semi-circle image is broken. I've tried changing the background colors to gray in cells and tables
3
3474
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or less would display, but those close to 300 pixels/inch or greater would not (MS Access cannot recognize the file format xxx.jpg). The larger, original images were scanned and saved as .bmp (at 300 dpi producing a 15MB file). Then the images were...
9
5538
by: Eric Lindsay | last post by:
I can't figure how to best display little snippets of shell script using <pre>. I just got around to organising to bulk validate some of my web pages, and one of the problems occurs with Bash shell pieces like this: <pre><code> #!/bin/sh ftp -i -n ftp.server.com&lt; &lt;EOF user username password epsv4 cd /
22
2684
by: Michael Levin | last post by:
I have a very simple page, which shows 3 Quicktime movies in a table. I think I'm using just standard simple HTML. In Netscape or Safari on a Mac, they look fine. In Internet Explorer on a PC, the bottom of the movies are cut off (size issues with the table cells). Could someone look at the html here http://server.drmichaellevin.org/worm_supplement.html and tell me why this is different on different platforms?
9
3922
by: Nathan Sokalski | last post by:
I have several TextBoxes with TextMode="MultiLine" in which I want to limit the number of characters that can be entered using a RegularExpressionValidator. I have come up with the following ValidationExpression: {0,250} The only problem with this ValidationExpression is that it does not include the \n character as stated on the following documentation page:
29
2336
by: dbhbarton | last post by:
Had a thought that's grown on me. No idea if it's original or not- too inexperienced in programming- but I guess there's no harm floating it out there. Python wins big on readability, and there's no doubt that context- dependent text formatting in IDEs (keywords, strings, comments etc) is a massive help too, therefore benefitting development and maintenance. This idea is in a similar vein, especially for when scripts grow large.
0
8059
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8000
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8495
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8470
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8145
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8330
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5475
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3960
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.