473,322 Members | 1,504 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,322 software developers and data experts.

Custom validator control does not always fire

Hello.

If I use an asp.net custom validator control to validate a textbox,
what I find is that if I enter in some text that I have already
entered and validated in a previous session (you know when you start
typing inside a textbox, you see things that have already been typed
before), then when I click off the textbox, the custom validator
client side jscript does not run. I really need the custom jscript
validator code to run everytime, regardless of whether the text in
question has been successfully validated before in a previous session.

Thanks if anyone knows the answer!

-dnw.
Nov 18 '05 #1
2 5365
Validators only fire when the browser invokes the onchange event associated
with the field.

Unfortunately, onchange does not fire in some cases:
- If you edit the field but edit it back to the original.
- If you pick from the AutoComplete dropdown (which I think you are talking
about). Its annoying and personally, I think its a design flaw in IE.

Microsoft has provided a good defense for this: the server side always
validates. You should NEVER assume the client-side validates. Only IE and
IE/Mac browsers support the client-side validation code because its written
in DHTML. The user can disable javascript on those same browsers. So you
must be sure that Page.Validate() is called (it happens automatically on
buttons whose CausesValidation property is true) and you test for
Page.IsValid prior to saving.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Dot net work" <do***@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
Hello.

If I use an asp.net custom validator control to validate a textbox,
what I find is that if I enter in some text that I have already
entered and validated in a previous session (you know when you start
typing inside a textbox, you see things that have already been typed
before), then when I click off the textbox, the custom validator
client side jscript does not run. I really need the custom jscript
validator code to run everytime, regardless of whether the text in
question has been successfully validated before in a previous session.

Thanks if anyone knows the answer!

-dnw.

Nov 18 '05 #2
Thanks very much for the info.

"Peter Blum" <PL****@Blum.info> wrote in message news:<uo*************@TK2MSFTNGP12.phx.gbl>...
Validators only fire when the browser invokes the onchange event associated
with the field.

Unfortunately, onchange does not fire in some cases:
- If you edit the field but edit it back to the original.
- If you pick from the AutoComplete dropdown (which I think you are talking
about). Its annoying and personally, I think its a design flaw in IE.

Microsoft has provided a good defense for this: the server side always
validates. You should NEVER assume the client-side validates. Only IE and
IE/Mac browsers support the client-side validation code because its written
in DHTML. The user can disable javascript on those same browsers. So you
must be sure that Page.Validate() is called (it happens automatically on
buttons whose CausesValidation property is true) and you test for
Page.IsValid prior to saving.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Dot net work" <do***@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
Hello.

If I use an asp.net custom validator control to validate a textbox,
what I find is that if I enter in some text that I have already
entered and validated in a previous session (you know when you start
typing inside a textbox, you see things that have already been typed
before), then when I click off the textbox, the custom validator
client side jscript does not run. I really need the custom jscript
validator code to run everytime, regardless of whether the text in
question has been successfully validated before in a previous session.

Thanks if anyone knows the answer!

-dnw.

Nov 18 '05 #3

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

Similar topics

2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
2
by: Evgueni | last post by:
Hello, I am new to .NET, and a custom validator is giving me a lot of grief. I want to use a Custom Validation control and for some reasons it's not firing the validation procedure. I am using...
10
by: Rigs | last post by:
Hi, I have a textbox with a Custom Validator that utilizes the OnServerValidate method for that textbox. This works fine, however the method only executes when data exists in that textbox after...
5
by: Richard Payne | last post by:
Hi This is probably a newbie question but I can't seem to find a clear answer to the problem I have. I have created a Custom Validator control on my webform that works fine, but when I put...
9
by: Alex Shirley | last post by:
Hi there I’m simply trying to check for a blank or empty value in a textbox on my webform. In this instance I do not want to use a requiredfieldvalidator, I want to use a customvalidator (as I...
1
by: Elie Medeiros via .NET 247 | last post by:
Hi there, I have written a custom validator function to validate a datefrom a user-filled field. The function tries to parse the dateand if it can't, sets (serverValidateEventArgs)e.IsValid...
5
by: Mattyw | last post by:
Hi, I'm relatively new to Web Forms, I have been using Required Field Validators and Regular Expression Validators on a Web Form I am developing and everything works as expected using Visual...
3
by: Andy | last post by:
Hi folks, I have a customvalidator control that works properly if it isn't contained in an ASP:TABLE. But, when I place it inside an ASP:TABLE, I find that _ServerValidate doesn't get fired,...
3
by: Rich Squid | last post by:
Hello Here's my basic problem: On my asp.net form page I have a DetailsView (default mode=edit) bound to a AccessDataSource control. Users can successfuly update a databound template field,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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.