Spring naar inhoud

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:

  1. Add a “requiredValidator” validator to the List Box Control;
  2. Define the onclick event of the List Box Control as Partial Update and point to the Link Control;
  3. Make the Link type of the Link Control computed;
  4. 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 onclick onchange 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

Nog geen reacties

Geef een reactie

Fill in your details below or click an icon to log in:

WordPress.com logo

Je reageert onder je WordPress.com account. Log Out / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log Out / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log Out / Bijwerken )

Verbinden met %s

Follow

Get every new post delivered to your Inbox.