Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Filtering before validation

My models use beforeSave to sanitize and trim data. But I also use the model validation and some regex validations require that the values have no spaces.

Trim is used to remove unwanted spaces but beforeSave runs after the validation so the regex fails before trim.

How can I trim/escape/sanitize values before the validation?

Woops! I missed that. Thanks a lot.