Home All Groups Group Topic Archive Search About
Author
19 Jul 2005 4:22 AM
Mike Randall
I have the exact same results as Ken.    I have a large page with about 40
regular validators and 4 custom ones (server side only).   The custom
validators will only fire after the regular error conditions have been
cleared.

I use a validation summary and end up with 2 pass validation.

Not good.


Show quoteHide quote
"Peter Blum" <PLB***@Blum.info> wrote in message
news:%239VrWW%23dEHA.1644@tk2msftngp13.phx.gbl...
>I agree that we need the code. I saw some code from you in another thread.
> Overall it looked good although it lacks any client-side code. That means
> it
> will validate only when the server side code runs validation.
>
> The CustomValidator is just another generic Validator control to the core
> client and server side code that validate a page. When you submit, the
> code
> goes through every validator that is not marked disabled (its Enabled
> property = false) and validates it. It does not stop on any particular
> validator. There are no dependencies between validators. This is true on
> both client and server side.
>
> There are a couple of common problems users have with CustomValidators:
> 1. Expect client-side validation when no code was written
> 2. Do not correctly setup the ServerValidate event handler so it never
> gets
> called on the server side
> 3. Want it to fire when there is a blank textbox. It will not unless you
> do
> not assign anything to ControlToValidate.
>
> --- Peter Blum
> www.PeterBlum.com
> Email: PLB***@PeterBlum.com
> Creator of "Professional Validation And More" at
> http://www.peterblum.com/vam/home.aspx
>
> "ken bus" <ken***@discussions.microsoft.com> wrote in message
> news:A9A28454-732E-4CF9-B267-848AFCE47EA6@microsoft.com...
>> If this is intended behavior the documentation is rotten!
>> One customvalidator in an error state with one or more other noncustom
> validators in a like state will cause unexpected behavior.
>> One would think that this customVal would act like the other val controls
> but this doesn't occur. The customVal will only report its error if all
> the
> other val controls are not reporting errors whether or not one is using a
> summary control. Only when all the other val controls have had their
> errors
> corrected, will the customVal behave as expected. One would think it
> should
> report its message along with the others in the summary control.
>
>

Author
20 Jul 2005 1:11 AM
Peter Blum
Validation occurs twice: on the client-side to prevent the page from
submitting if there are any errors and on the server side after post back.
This is to protect you when the server doesn't support the client-side
validation. (Client-side validation is not available on non-IE browsers in
ASP.NET 1.x and when javascript is disabled on the browser.)

So your RegularExpressionValidators all are validated on the client-side.
But not the customvalidators because you didn't add client-side code for
them. Until all validators with client-side code are accepted, the page does
not post back and the server side validation (which includes EVERY
validator) runs.

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

Show quoteHide quote
"Mike Randall" <comstar> wrote in message
news:N-adnSjiuYNl4kHfRVn-pQ@comcast.com...
>I have the exact same results as Ken.    I have a large page with about 40
>regular validators and 4 custom ones (server side only).   The custom
>validators will only fire after the regular error conditions have been
>cleared.
>
> I use a validation summary and end up with 2 pass validation.
>
> Not good.
>
>
> "Peter Blum" <PLB***@Blum.info> wrote in message
> news:%239VrWW%23dEHA.1644@tk2msftngp13.phx.gbl...
>>I agree that we need the code. I saw some code from you in another thread.
>> Overall it looked good although it lacks any client-side code. That means
>> it
>> will validate only when the server side code runs validation.
>>
>> The CustomValidator is just another generic Validator control to the core
>> client and server side code that validate a page. When you submit, the
>> code
>> goes through every validator that is not marked disabled (its Enabled
>> property = false) and validates it. It does not stop on any particular
>> validator. There are no dependencies between validators. This is true on
>> both client and server side.
>>
>> There are a couple of common problems users have with CustomValidators:
>> 1. Expect client-side validation when no code was written
>> 2. Do not correctly setup the ServerValidate event handler so it never
>> gets
>> called on the server side
>> 3. Want it to fire when there is a blank textbox. It will not unless you
>> do
>> not assign anything to ControlToValidate.
>>
>> --- Peter Blum
>> www.PeterBlum.com
>> Email: PLB***@PeterBlum.com
>> Creator of "Professional Validation And More" at
>> http://www.peterblum.com/vam/home.aspx
>>
>> "ken bus" <ken***@discussions.microsoft.com> wrote in message
>> news:A9A28454-732E-4CF9-B267-848AFCE47EA6@microsoft.com...
>>> If this is intended behavior the documentation is rotten!
>>> One customvalidator in an error state with one or more other noncustom
>> validators in a like state will cause unexpected behavior.
>>> One would think that this customVal would act like the other val
>>> controls
>> but this doesn't occur. The customVal will only report its error if all
>> the
>> other val controls are not reporting errors whether or not one is using a
>> summary control. Only when all the other val controls have had their
>> errors
>> corrected, will the customVal behave as expected. One would think it
>> should
>> report its message along with the others in the summary control.
>>
>>
>
>

Bookmark and Share