Book Image

SharePoint Designer Tutorial: Working with SharePoint Websites

By : Mike Poole
Book Image

SharePoint Designer Tutorial: Working with SharePoint Websites

By: Mike Poole

Overview of this book

Table of Contents (17 chapters)
SharePoint Designer Tutorial
Credits
About the Author
About the Reviewer
Preface
Index

Validating Our Forms


We can add validation controls to our form that will check the information input by the user. If they input an incorrect value, then an error message will be displayed.

There are several different types of validation controls. Each performs a specific type of validation when the form is updated.

We will add a RangeValidator to our form to check that the birthday we have selected is credible:

  1. Click and drag a RangeValidator control onto our form.

  2. Right-click on the validation control and select Properties from the shortcut menu.

  3. Set the ControlToValidate to txtBirthday.

  4. Change the Type from String to Date.

  5. Set the MinimumValue to 1/1/1880.

  6. Set the MaximumValue to 1/1/2009.

  7. Set the ErrorMessage to Please select a credible birthday.

If we return to our birthday page in our web browser, we see that if we enter a spurious date such as 1/1/1850 and then press Enter to cause a postback, the validation kicks in and we are greeted with an error message.