Creating or configuring forms > Configuring the <pages> element > Configuring a static page layout > Configuring validation in static forms

6.2.3.1 Configuring validation in static forms

With the <validation> element, you can set rules to check if the inputs on a page are valid. A user cannot proceed to the next page until inputs are valid values. After the user tries to proceed to the next page, the validation is checked and the response is fired. Once this occurs the validation is continuously checked on the page. As soon as the user enters a valid value, the warning messages go away and the Next button is re-enabled. This differs from the individual component validation which is constantly being checked as soon as the user starts entering data.

To configure validation in static forms

  1. Open the desired xml file located in the Viewpoint home directory. Locate the <pages> element.
  2. Set <validation> as a child of <component>.
  3. Insert <requirement> within <validation> to define the conditions of the field(s).
  4. Place the <response> element inside of <validation> to describe the behavior of the Viewpoint interface when <requirement> evaluates to false. It specifies which components will be invalidated.
  5. Insert the <message> element within <response> and create a warning message for the user.
  6. Insert any of the invalidated <component> elements you would like included with the message.
  7. <validation>
      <requirement logical-operation="and">
        <rule comparison="lessthan">
          <first>
            <variable binary-operation="add">
              <first>
                <component id="linuxVMCount" />
              </first>
              <second>
                <component id="windowsVMCount" />
              </second>
            </variable>
          </first>
          <second>
            <value>10</value>
          </second>
        </rule>
      </requirement>
      <response>
        <message>You cannot create more than a total of 10 VMs</message>
        <component id="linuxVMCount" />
        <component id="windowsVMCount" />
      </response>
    </validation>

    Users are prevented from creating more than ten reservations of any type.

Related topics