Plain JavaScript, run via flutter_js. Optional - only needed for checks that compare
multiple fields against each other; a form's own required/min/max/regex rules
(see the Form Editor)
already cover single-field validation. Edited via the Script
Editor. Runs after those static rules pass and
before process.js - see the full processing
pipeline.
APIs available
| Name | Type | Meaning |
|---|---|---|
inputs |
object | The submitted values, keyed by field id. Each script runs in its own isolated context, so writing to it here has no effect anywhere else. |
errors |
object | Write validation messages into it. Its final state when the script finishes is what matters - the return value is ignored. |
if (inputs.sale_price <= 0) {
errors["sale_price"] = "Sale price must be greater than zero.";
}
if (inputs.year < 1900 || inputs.year > new Date().getFullYear() + 1) {
errors["year"] = "Enter a valid model year.";
}
Field errors vs. general errors
errors["field_id"]- shows inline under that field. The key must match a real field id.- Any other key - e.g.
errors["main"] = "At least 4 options are required";- doesn't match a field id, so it shows instead as a form-level banner above the fields. Use as many distinct non-field keys as you need to report more than one general message; each key holds a single string, not an array (errors.main.push(...)doesn't work -errorsis a plain object). - Leave
errorscompletely untouched when there's nothing to report.
Writing anything to errors - field-specific or general - stops the submission there;
process.js doesn't run.