In our 4-days XPages course we look at the several possible input validation strategies, client-side and server-side.
One of the students, Oscar Bout, expert on Dojo told me he was missing the client-side Dojo strategy using the dijit.form.ValidationTextBox control in combination with and dojo.form.Form.
We tried his code which gaves the error popup as shown in fig. 1
How to implement this?
- Select the Edit Box Control and select All Properties\dojo \dojoType and enter dijit.form.ValidationTextBox;
- Select All Properties \ Dojo \ dojoAttributes and click 3 time on the + button to create three attributes (see fig 2):
- Dojo attribute 1: name: invalidMessage, value: your error message
- Dojo attribute 2: name: required, value: true
- Dojo attribute 3: name: regExp, value (your regular expression to test the input):
- Select the XPage and select All Properties\dojo and enter the next values (see fig 3):
- dojoForm: true
- dojoParseOnLoad: false
- dojoThemo: true