Re: IValidator - multiple error messages

From: Peter Blum (PLBlum_at_Blum.info)
Date: 12/07/04


Date: Tue, 7 Dec 2004 11:13:35 -0500

Hi Pete,

A big focus of my business is data entry validation on webforms. So I have
some knowledge of the issues you raise.

* You can certainly write out a single string, containing all of your error
messages. There are two ways. Use a Label that you assign the text and make
visible when there is an error. Use a CustomValidator and within the
"evaluation function" that you write, you do all that validation and assign
the ErrorMessage property.

* There are formatting challenges when you have lengthy strings displayed in
the web form. Often users like to delegate a lengthy list of error messages
to the ValidationSummary control which groups them together and shows them
as a list.

* The ValidationSummary control is designed for single validation errors so
that it's formatting rules can build separate lines for each error found.

* Recommendation: Use the ValidationSummary control. Add a PlaceHolder
control somewhere to the page. For each error message that you get back,
create a CustomValidator object with its ErrorMessage assigned and its
Display property set to None. Set it to an "evaluation function" that simply
evaluates as "invalid". This way, you are creating a list of error messages
on the fly that will appear in the ValidationSummary.

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

"Peter Morris [Air Software Ltd]" <peter.morris@guess.co.uk> wrote in
message news:eh4zzaF3EHA.3376@TK2MSFTNGP12.phx.gbl...
> Hi all
>
> I want a validator which
> A) Doesn't validate a control
> B) Is able to report more than one error
>
> The reason for this is that I am validating a whole business object based
> on a list of expressions, rather than individual controls.
>
> Is it possible to do this? Could someone please tell me how, because I
> can only see IValidator and the ability to add a single error from my
> single class (I don't want to use multiple validators).
>
> Thanks
>
>
> --
> Pete
> ====
> Audio compression components, DIB graphics controls, FastStrings
> http://www.droopyeyes.com
>
> Read or write articles on just about anything
> http://www.HowToDoThings.com
>
> My blog
> http://blogs.slcdug.org/petermorris/
>



Relevant Pages

  • Re: Access 2007 Technical Questions
    ... If your users are encountering Validation ... Rules being exercised when the control loses focus, ... developer is responsible for handling this with VBA code. ... and allows queries instead of cursors ...
    (microsoft.public.access.formscoding)
  • Re: Access 2007 Technical Questions
    ... it would be nice to be able to turn of validation. ... since we do have the before update event also (this is ... forcing the user to STAY on control, or use some quit button on the form! ... then you STILL MUST HAVE form's level validation code!!!. ...
    (microsoft.public.access.formscoding)
  • Re: Access 2007 Technical Questions
    ... When you state put a button on the form, do you mean a command button? ... validation rules as set in the events of that previous control, ... it doesn't matter which of the 2 validation events you put it ... in the validation rules as far as this point is concerned. ...
    (microsoft.public.access.formscoding)
  • Re: Validators in composite control firing prematurely
    ... and seems we can do some certain trick in our composite control's code. ... Then, we override our Custom Control's OnLoad method, there when postback, ... composite control. ... this approach need to disable clientside validation (since the ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Access 2007 Technical Questions
    ... the event model and change to ms-access is not likely. ... it would be nice to be able to turn of validation. ... also have to turn off the before update event. ... forcing the user to STAY on control, or use some quit button on the form! ...
    (microsoft.public.access.formscoding)