Cross-Field Validation
- A field (minAmount) may have a relatedFields entry, which is a list of field names (e.g, [loanAmount]) in the current actor. When the value of the field (minAmount) is updated and validated, the related fields are validated automatically.
- A field (loanAmount) may have a validation entry, which has
- condition: if the condition is evaluated true, check the validation rule.
- rule: if the rule is evaluated false, the message is displayed.
- message
Status
Release Available | Status | Framework Name |
---|---|---|
3.2 | Current | MUI and Mint |
Code JSON
"fields": [ { "id": "74a8", "fieldName": "minAmount", "fieldUi": { "fieldType": "currency", "label": "Minimum Amount", "required": true, "relatedFields": [ "loanAmount" ], "format": { "options": { "numeral": true, "numeralThousandsGroupStyle": "thousand" }}}},
Code JSON
{ "id": "ea6f", "fieldName": "loanAmount", "fieldUi": { "fieldType": "currency", "label": "Loan Amount", "required": true, "validation": [{ "rule": "$this.attr(loanAmount); >= $this.attr(minAmount);", "condition": "$this.attr(minAmount); != undefined and $this.attr(loanAmount); != undefined", "message": "Loan amount cannot be less than $this.attr(minAmount, currency);." }], "format": { "options": { "numeral": true, "numeralThousandsGroupStyle": "thousand" }}}}]
Code JSON
{ "id": "4782", "fieldName": "newPassword", "fieldUi": { "fieldType": "string", "label": "Password", "required": true, "secure": true, "relatedFields": [ "confirmedPassword" ], "messages": { "requiredErrorText": "Password is required." } } }
Code JSON
{ "id": "8f43", "fieldName": "confirmedPassword", "fieldUi": { "fieldType": "string", "label": "Confirmed Password", "required": true, "secure": true, "validation": [{ "rule": "$this.attr(newPassword); == $this.attr(confirmedPassword);", "condition": "$this.attr(newPassword); != undefined and $this.attr(confirmedPassword); != undefined", "message": "Password and confirmed password are not same." }], "messages": { "requiredErrorText": "Confirmed password is required." }}}]