Spring naar inhoud

dijit.form.ValidationTextBox

februari 23, 2011

Fig 1. Error message is shown when user type wrong Dutch zip code

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?

  1. Select the Edit Box Control and select All Properties\dojo \dojoType and enter dijit.form.ValidationTextBox;
  2. Select All Properties \ Dojo \ dojoAttributes and click 3 time on the + button to create three attributes (see fig 2):
    1. Dojo attribute 1: name: invalidMessage, value: your error message
    2. Dojo attribute 2: name: required, value: true
    3. Dojo attribute 3: name: regExp, value (your regular expression to test the input):
      [0-9]{4}[ a-zA-Z][a-zA-Z]{1,2}
  3. Select the XPage and select All Properties\dojo and enter the next values (see fig 3):
    1. dojoForm: true
    2. dojoParseOnLoad: false
    3. dojoThemo: true
fig2. dijit.form.ValidationTextBox
fig 3. XPages dojo form value
5 reacties leave one →
  1. Johnny Oldenburger permalink
    februari 24, 2011 15.40

    Hallo Rob,
    Dank je wel dat je dit nog even op deze wijze duidelijk hebt uitgewerkt.
    Was een mooie toevoeging aan de 4 daagse cursus.
    Ben er mee aan het testen en het ziet er inderdaad mooi uit en het werkt stabiel.

  2. maart 1, 2011 15.02

    En, ben je er al verder mee gekomen?

    • maart 1, 2011 16.08

      Ik heb ook een Dojo-cursus die gebaseerd is op clasic Domino webdevelopment. Maar om daar een nieuwe cursus van te maken? Misschien is ik beter in deze blog de diverse technieken en instellingen laten zien geënt op XPages. Moet er wel tijd voor maken.

      Mocht jij al voorbeelden hebben dan houd ik mij aanbevolen. Eventueel geef ik je voldoende rechten om in deze blog te publiceren.

  3. Manfred Meise permalink
    juni 18, 2011 19.06

    Hi Rob,

    great idea to enhance XPage validation. I have done a description which is even more easy

    http://www.mmi-consult.de/FAQ/dx/alternative-validierung-von-eingabefeldern-in-xpages-mit-dijit.form.validationtextbox.htm

    Manfred

Plaats een reactie