Simulation @Prompt with dijit.Dialog – part 2
maart 31, 2011
In my previous post you saw an example of how to use dijit.Dialog in a XPages application as a way to ask the user for information. However no input validation was implemented.
This post will show you how to display a warning when the user forgets to select a value from the list.
To achieve this you have to change the selector.xsp XPage (discussed in my prevous post) in 4 steps:
- Add a “requiredValidator” validator to the List Box Control;
- Define the onclick event of the List Box Control as Partial Update and point to the Link Control;
- Make the Link type of the Link Control computed;
- Define some dummy code for the onclick event of the Link Control.
Step 1
- Open the selector.xsp XPage in the Domino Designer;
- Select the List Control and open the Properties view;
- Select All properties\data\validators -> plus(+)-button and select xp:validateRequired from the list;
- Add a warning message, e.g. Please select a value from the list.
Step 2
- With the List Control still selected, open the Events view and select the
onclickonchange event; - In de Server Options box select Partial Update;
- Click on the Select Element… button;
- Select link1 from the list and press OK.
Step 3
- Select the Link Control;
- In the Properties view select the Link tab;
- In the Options box change the Link type to Compute value… and add the following Server-Side JavaScript code:
var listBox1:com.ibm.xsp.component.xp.XspSelectManyListbox =
getComponent("listBox1");
if (listBox1.getValue() == null) {
return "";
} else {
return "/xPerson.xsp"; // open person form
}
Step 4
- The Link Control still selected, open the Events view;
- Add the next Server-Side JavaScript dummy code to the onclick event:
var x = null; // somehow you need a statement
Success
More information
XP852 – Lotus Domino Designer 8.5.2 Basic XPage Applications
Related Articles
- Simulation @Prompt with dijit.Dialog (appligate.wordpress.com)
- dijit.Dialog (appligate.wordpress.com)
Nog geen reacties