Initializing help system before first use

vdl-validate

Add a validation rule to a <vdl-field> or <vdl-table-column> element. You can declare multiple <vdl-validate> rules within a <vdl-field> or <vdl-table-column> and they will all be applied. Each rule can specify whether the field is allowed to save data if that rule fails (this is soft validation). The "pass" attribute defines the expression that is called every time the field or autocolumn changes. The expression is automatically given the variables: "entityName", "value", "indices" and "rowData" (if used with vdl-table). "entityName" is the name of the entity bound to the field, "value" is the current value being input, "indices" is an array of indices if the field is bound to an array element and rowData is an array containing indices and values of the current row.

Required parent element

Must be contained within one of the following elements:

Example

<vdl-form>
  <vdl-field entity="Demand">
    <vdl-validate pass="=value >= scenario.entities.SupportLevel.value" allow-save="=scenario.entities.CanSave.value">
      Demand should be greater than or equal to SupportLevel
    </vdl-validate>
  </vdl-field>
</vdl-form>

<vdl-table>
  <vdl-table-column entity="FactoryDemand">
    <vdl-validate pass="=value >= scenario.entities.SupportLevel.value" allow-save="=scenario.entities.CanSave.value">
      FactoryDemand should be greater than or equal to SupportLevel
    </vdl-validate>
  </vdl-table-column>
</vdl-table>

Attributes

pass Expression to used for validating the value of a <vdl-field> or <vdl-table-column>. This must be an expression and should resolve to either a function or a boolean value. If a function it will be executed on each change to the vdl-field or vdl-table-column and also when a save is attempted. The function will have the following signature (entityName, value, key) and should return a boolean.
Variable Type Description
entityName string Name of the entity being validated
value (string|boolean|number) Value to be validated. The data type depends on the user input binding
indices ?Array.<(string|boolean|number)> Optional array indices provided when binding to an array element
rowData ?Array.<(string|boolean|number)> Optional array containing indices and values of the current row. Provided when tag is used in combination with vdl-table.
requires expression required
allow-save If set to true this will allow a field to be saved even though it is marked as invalid. Defaults to false accepts expression

Element contents

Text content only

Text content of the element is used as the message to display when attempting to save and validation fails

© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.