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

6.2.4.1 Configuring validation in dynamic 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 dynamic forms

  1. Open the desired xml file located in the Viewpoint home directory. Find the <pages> element.
  2. Choose a <page> to validate. Set <validation> as a child of the corresponding <page> element.
  3. Insert <requirement>within <validation> to specify the conditions of the field(s). See Setting component rules.
  4. Place  <response> inside of <validation> to describe the behavior of the Viewpoint interface when <requirement> evaluates to false. It defines which components to invalidate.
    1. Insert the <message> element within <response> to create a warning message for the user.
    2. Insert any <component> elements that are invalidated to be included with the message.
  5. <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