Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Custom Validation Summary Problem

Reply
Thread Tools

Custom Validation Summary Problem

 
 
kpg
Guest
Posts: n/a
 
      12-15-2006
I can't get the CustomValidator (CV) ErrorMessage to display
in the ValidationSummary.

On the same page I have several RequiredField Validators
and a Range Validator, that all work just fine, that is,
the ErrorMessage text is displayed by the Validation summary
control.

If I leave the CV Text field blank then the errormmessage
does display on the CV itself.

According to the MSDN help, the Validation summary control
should display the messages of all validator controls
on the page.

Is this a bug or am I doing something wrong?

kpg
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      12-15-2006
the validation summary only updates its display when a submit is attempted.

-- bruce (sqlwork.com)

kpg wrote:
> I can't get the CustomValidator (CV) ErrorMessage to display
> in the ValidationSummary.
>
> On the same page I have several RequiredField Validators
> and a Range Validator, that all work just fine, that is,
> the ErrorMessage text is displayed by the Validation summary
> control.
>
> If I leave the CV Text field blank then the errormmessage
> does display on the CV itself.
>
> According to the MSDN help, the Validation summary control
> should display the messages of all validator controls
> on the page.
>
> Is this a bug or am I doing something wrong?
>
> kpg

 
Reply With Quote
 
 
 
 
kpg
Guest
Posts: n/a
 
      12-15-2006
bruce barker <(E-Mail Removed)> wrote in
news:ewSn#$(E-Mail Removed):

> the validation summary only updates its display when a submit is
> attempted.


I have a submit button with validation set to true, when
clicked, the other vaidation control's error messages are
displayed in the validation control. Everything is set up
properly, but the custom validator's errormessage does not
display in the validation summary message box.

kpg
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      12-15-2006
There are several things you need to ensure to have a customValidator
work.

1) The customValidator has to appear in the same container as the field
being validated

2) Even if you aren't using client-side validation, you still have to
specify an empty error checking function in the JScript of the HTML
page on which the validator resides. And, this "dummy" function has to
return true for its args (make sure you specify the name of this
function in the property list for the validator)

function customvalidator(source,args){
args.IsValid=true;
}

3) In the server-side custom validation code, you have to set three
properties on your validator if the check failed for the message to
appear in the summary control, and your server-side custom validation
code has to return false for edit failures:


private function yourCustomCheckingRoutine()
System.Boolean blnResult=true;

if(yourTest)
{
blnResult=false;
cvYourValidator.ErrorMessage="Your error message";
cvYourValidator.Text="*";
cvYourValidator.IsValid=false;
}

return(blnResult);
}

 
Reply With Quote
 
kpg
Guest
Posts: n/a
 
      12-15-2006
"Andy" <(E-Mail Removed)> wrote in
news:(E-Mail Removed) oups.com:

> 2) Even if you aren't using client-side validation, you still have to
> specify an empty error checking function in the JScript of the HTML
> page on which the validator resides. And, this "dummy" function has to
> return true for its args (make sure you specify the name of this
> function in the property list for the validator)



This was it. Once I added the dummy function it worked.

This must be a bug, the documentation says the client side script
is optional.

Thanks
kpg
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation Summary not showing for client side validation cwhankey@gmail.com ASP .Net 1 12-12-2008 02:32 AM
Using Summary Validation control with server Custom validation =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= ASP .Net 2 10-15-2004 06:15 PM
Displaying a Validation Error in a Validation Summary Control Lucas Tam ASP .Net 2 02-26-2004 07:49 PM
validation summary doesnt display when there's client-side validation Libs ASP .Net 0 06-25-2003 03:05 PM
Re: only custom validation control does server side validation? Colin Mackay ASP .Net 0 06-25-2003 07:54 AM



Advertisments