Validate Form server behavior

This server behavior allows adding validation rules to transaction form fields, in order to ensure that only correct data is entered.

To add a Validate Form trigger into the page, you must follow the next steps:

  1. First create an Insert, Update, Custom or Login transaction. The server behavior is implemented as a trigger, therefore a transaction must exist on the page, so that the trigger can register to it. If more than one transaction exists, the trigger will register to all of them.
  2. Access the server behavior from the Application panel, Server Behaviors -> + -> MX Kollection -> Form Validation -> Validate Form.
  3. The user interface that opens is divided into two tabs. Configure these tabs as follows:
    · The Basic tab, where options related to the actual validation must be set.
    · The Advanced tab, where trigger specific options can be set.
  4. Once you're done setting the options, click OK to apply the server behavior.

The Basic tab

The purpose of this user interface tab is to allow the developer set up the validation rules for each transaction field:

 

To set the dialog box options, follow the next steps:

  1. The Form fields area displays all the transaction fields to which validation rules can be applied. The fields list is retrieved from the registered transactions. If registered to multiple transactions, the area will contain the reunion of the transaction fields.
    The area displays the field name, how it is submitted, the required state and the associated validation format. After selecting a field from the grid, you can set its options, using the elements below.
  2. The Required checkbox determines whether the selected field is mandatory or not. If checked, it will display a red * in the form, next to the field name.
  3. In the Validation format drop-down menu select the validation rule to apply on input data. The following options are available:
  4. In the following text boxes you can choose a minimal and maximal value, depending on the validation type and format selected earlier.
  5. If the Custom message option is checked, you can define your own error message to be displayed when the data does not match the validation format.
  6. In the Error message text box (enabled when the option above is checked) enter the custom message that users will see when entering data that does not conform with the defined rule. All form fields that require validation have a default error message. The custom error message overwrites the default one.
  7. The three buttons in the top right corner of the interface offer you the next functionalities:
    · Click OK when you are done configuring the server behavior.
    · Click Cancel to exit without the new settings to be applied.
    · The Help button takes you to this help page.
    These buttons appear on both interfaces of the Validate Form trigger.
  8. Click on the Advanced tab to continue with configuring the trigger.

The Advanced tab

The purpose of this user interface tab is to allow the developer to change the default trigger properties, to suit the particular situation. All trigger properties (name, type, priority, transactions) can be set from this dialog box:

 

For instructions on completing this step, see the Advanced tab. For the Validate Form trigger, by default the Priority is set to 10 and the Type is BEFORE, as it should execute before the transaction takes place.

The server behavior added this way can be edited later by double-clicking its name in the Server Behaviors tab of the Application panel.