Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   BaseValidator Inherited Ctrl Not working with RequiredFieldValidator (http://www.velocityreviews.com/forums/t757988-basevalidator-inherited-ctrl-not-working-with-requiredfieldvalidator.html)

James 10-16-2005 11:13 PM

BaseValidator Inherited Ctrl Not working with RequiredFieldValidator
 
Hi All,

I have written a control that inherits BaseValidator. If it used by
itself on a page, the control works perfectly fine.

If I drop the RequiredFieldValidator on the same page to evaluate a
different textbox, my control does not work. But *only* if
RequiredFieldValidator does not pass.

It seems like when RequiredFieldValidator raises False, it shuts
everything else off.

I placed a breakpoint in my control, and it doesn't even go into it.

Any suggestions are greatly appreciated!

Thanks!!
James


James 10-16-2005 11:17 PM

Re: BaseValidator Inherited Ctrl Not working with RequiredFieldValidator
 
Well, after I placed this post, I tried changing "Enable Client Script"
to FALSE on the RequiredFieldValidator control.

This allowed my control to work properly!

I'm not using client side scripting, so this not an issue. But it
would seem strange that this would have to be the case.

Perhaps somebody could explain why this would need to be done?

Thanks!
James


Teemu Keiski 12-04-2005 11:35 AM

Re: BaseValidator Inherited Ctrl Not working with RequiredFieldValidator
 
Hi,

at client if RequiredFieldValidator fails, that already prevents the page
from posting back (since one of the validators indicates error).

It is so that if your control has no input/selection whatsoever,
RequiredFieldValidator is the one catching that, and no other validators
will be yet invoked (e.g by default no other validator than RFV is applied
for empty input). Then if there is some input, RFV will pass validation, and
other, more specialized validators kick in, like check the correctness of
the given input, as the input now exists.

Mechanically it happens so that if validation control is passed empty input
value, it returns true as outcome of the validation. This way, it's left up
to the RFV in the first place to check for empty inputs.

You can tweak this behaviour with custom validators / 3rd party validator
controls & components (Professional Validation And More for instance)

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


"James" <codepenguin@hotmail.com> wrote in message
news:1129504637.345112.131570@g47g2000cwa.googlegr oups.com...
> Well, after I placed this post, I tried changing "Enable Client Script"
> to FALSE on the RequiredFieldValidator control.
>
> This allowed my control to work properly!
>
> I'm not using client side scripting, so this not an issue. But it
> would seem strange that this would have to be the case.
>
> Perhaps somebody could explain why this would need to be done?
>
> Thanks!
> James
>





All times are GMT. The time now is 05:04 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.