473,320 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Displaying characters that cause a validator to fail

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

<asp:RegularExpressionValidator id="SeqFormat" runat="server"
Display="Static" ErrorMessage="Your sequence contains illegal characters"
ControlToValidate="Sequence"
ValidationExpression="^[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 1280
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 "Professional
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****@PeterBlum.com

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

<asp:RegularExpressionValidator id="SeqFormat" runat="server"
Display="Static" ErrorMessage="Your sequence contains illegal characters"
ControlToValidate="Sequence"
ValidationExpression="^[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
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...
23
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...
9
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...
33
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...
3
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...
9
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...
22
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...
9
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...
29
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.