Validation and Form State
“Validation” is not one operation in the SDK. Each validator protects a different boundary:
| Boundary | Validator | Failure shape |
|---|---|---|
| Declaration integrity | createSchema() | Throws for contradictory or inapplicable rules |
| One code-defined field | validateFieldValue() | { valid, value, error? } |
| One measurement | validateAndResolveMeasurement() | { valid, value?, error? } |
| A published BusinessDash form payload | validateFormSubmission() | { ok, issues } |
| Current dashboard-form runtime | createFormController().validate() | MissingField[] and updated controller errors |
| Live receiving contract | BusinessDash server | validation_failed and field issues |
Rules are definitions; errors are state
const budget = bd.number().validate({
greaterThan: 0,
lessThan: 1000000,
round: 2,
})
The rule object is stable metadata. An error such as “Budget must be less than 1,000,000” exists only after a particular value is checked. Store that error with the visitor's current form state, not by mutating the schema.
field definition + current value + sibling context
│
▼
validator
│
┌──────────┴──────────┐
▼ ▼
normalized value current error
round and floor are also normalizers, so a successful
validateFieldValue() result may contain a different value.
Required, conditional, and visible
.required()describes schema nullability.notNullrejects an empty value invalidateFieldValue().requiredIfrequires one field from sibling-value context.ConditionalBlockcontrols whether an entire render subtree is eligible to appear.
Those concepts can cooperate, but none is a substitute for another. A hidden branch should generally be omitted from active validation and submission by the runtime that owns the branch state.
Client and server
Client validation gives immediate feedback and avoids unnecessary requests. The Live server schema is still authoritative because it may have changed after the client loaded.
Always handle validation_failed, even after local validation passed.
For exact rule syntax, continue to Schema Validation.