How to validate a field against a Dynamic Range (Product Metadata)?
You can validate an input field against a min/max range that is pulled directly from your Product List (product metadata). This is ideal for quality checks where specifications change for each product.
In this example, the field is valid between weightMin and weightMax and weightMin2 and weightMax2 where:
- Valid (Green): weightMin and weightMax
- Valid: (Amber): weightMax and weightMin2
- Invalid (Red): 1==1

We will create three separate rules on the 'weight' field. The rules are checked from top to bottom.
Rule 1: Valid for the first range
(data["weight"]>=jobmeta["productWeightMin"])&&(data["weight"]<=jobmeta["productWeightMax"])

Step 1 - Drag in the field from the form layout and drop anywhere in the grey space

Step 2 - Drag in the 'greater than ≥' symbol



Step 4 - Drag in the 'AND' operator and drop after the parentheses

Step 5 - Dragging in the field from the form layout and replace the '0'

Step 6 - Drag in the 'less than' symbol ≤ and drop it inside the parentheses

Step 7 - Drag 'Product Data' on the '0' to replace. Click 'ratedSpeed' and select the product data e.g. weightMax

Step 8 - Click on the 'Valid' word

Step 9 - Set up the Form Status, Colour and add a message if needed.
Note: The Error status will not allow the user to submit the form until the field is valid.

Rule 2: Valid for the second range
(data["Metadata"]>=jobmeta["productWeightMin2"])&&(data["Metadata"]<=jobmeta["productWeightMax2"])

Rule 3: Create the catch-all invalid rule
1==1

Step 1 - Enter the rule 1==1 in the white area. This code invalidates everything outside of the valid range.
Step 2 - Click the 'valid' word and set the Form Status to 'invalid', select a colour and add a message if required.
