Error Message

This component will allow you to have friendly error messages with forms, that use event receivers for validation.

Installation

Run the commands to install and deploy as needed. Or use central admin to deploy. The final command will generate correct navigation after the solution has been deployed.

cd "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\"
stsadm.exe -o addsolution -filename components2.errormessage.wsp
stsadm.exe -o deploysolution -name components2.errormessage.wsp -local -allowgacdeployment

Configuration

Enable this feature per web application. For to central administration, web application features.

webapplication.jpg

Usage

Sometimes you need to use an event receivers to validate the saving of an item. For example validating that two dates, a from and to field, are correctly entered. (You could make a custom field, but it makes things harder to view/operate on normally in a list)

properties.Cancel = true;
properties.ErrorMessage = "'Date From' must be after the 'Date To'.";

The error message gets returned to the user like this

bigerror.jpg

This error is not very friendly to the user. It would be good if the error message was similar to a standard validator.
Using the component you can get error messages to display like this

errormessage.jpg

Future Developments

None identified

Last edited Mar 22, 2009 at 11:19 AM by djeeg, version 4

Comments

No comments yet.