Previous
TOC
Next
1. What will you learn
You will explore the different modes of data validation and use server
side validation and the error display components. You will become familiar
with xPages' error handling concepts and capabilities.
2. Task Description
You will create in your xScrapbook database a new page to explore the 2
server side error handling controls and their use. This exercise doesn't
constitute a part of our sample application.
3. Detailed Steps
1. Open the Scrapbook database and create a
new xPage called “validationTest”
2. Add
5 fields:
Name, TagLine, Color (drop down list with red, yellow, green), myCheckbox
(a checkbox) and itemCount
3. Make
the Name field a mandatory field and add an error message
4. Give
the TagLine field a minimum length of 4 and a maximum of 40, create a error
message.
5. Make
the itemCount a numeric display (in data)

and check out the dataConverter xp:convertNumber (in all properties)

Preview the results in the browser – we will introduce server side validation
there
6. Add
a “Display Error” control next to the Name control. Set its “Show error
messages for” property to “name”
7. Select
the name control and in “all properties” - data section, set “disable
clientSideValidation” to true

Add a Submit button and then test it in the browser.
8. Add
a “Display Errors” control into some space between the fields and the
submit button
9. Set
the “disableClientSideValidation” on the TagLine control
Test in browser
4. The Result

5. Things To Explore
- Use
a Script library for validation
- When
would you use client side and when server side validation?