Validation
Wires include powerful validations that you can use to validate your Data Properties.
Defining Constraints
You can define constraints within your wires using this.constraints.
component extends="cbwire.models.Component"{
this.constraints = {
"task": { required: true }
};
// Data Properties
data = {
"task": ""
};
}Validating
Actions can validate against the defined constraints using validate() or validateOrFail().
validate
Returns a ValidateResult object.
validateOrFail
Silently fails and prevents further processing of the current Action.
Validation Manager
You can get a new ValidationManager object to work with, just call getValidationManager();
Displaying Errors
Templates can access the ValidationResults object using args.validation. This includes helpful methods you can use for displaying error messages.
Last updated
Was this helpful?