Validation in web apps is actually a quite important subject: Mostly all information whichis actually entered througha final user needs some check my email regulations, no matter if he gets in an e-mail deal withor a subject matter for a discussion forum uploading.

While recognition on its own is very straightforward, embedding it into the remainder of the platform is actually not: If the user has gotten into a wrong value, the original page must be actually re-displayed, as well as the customer requires some well-readable information about what information he need to go into.

This chapter reveals:

  • how to utilize the validators becoming part of Flow
  • how to create your own validators
  • how to make use of recognition in your very own code
  • how validation is actually installed in the design, the perseverance and the MVC level

Automatic Verification Throughout The Platform

Inside Flow, verification is set off instantly at two areas: When an object is persisted, its own foundation validators are actually checked out as explained in the final segment. Furthermore, recognition happens in the MVC coating when a Domain name Version is actually utilized as a controller argument, straight after Characteristic Mapping.


If a verification error happens throughout determination, there is no chance to record this inaccuracy and also manage it –- as persistence is performed in the end of every demand after the response has been sent out to the customer.

Thus, verification on determination is actually simply a protect for stopping void information to become stored in the data bank.

When validation in the MVC coating occurs, it is achievable to take care of mistakes accurately. In summary, the process is as complies with:

  • an assortment of records is actually acquired from the customer
  • it is improved to an item making use of Feature Mapping
  • this things is actually confirmed utilizing the foundation validators
  • if there is actually a characteristic mapping or recognition error, the final webpage (whichgenerally contains an edit-form) is re-displayed, an error information is shown as well as the wrong area is actually highlighted.


If you would like to decrease the re-display of the final webpage (whichis actually handled througherrorAction() , you can add a @Flow \ IgnoreValidation("$ comment") annotation to the docblock of the equivalent operator action.

Normally, you build up your Operator withdifferent activities for presenting a type to edit a company as well as one more activity to in fact create/remove/update the entity. For those actions the verification for Domain Style arguments is triggered as revealed above. So so as for the automated re-display of the previous edit form to function, the validation inside that action needs to become reduced, otherwise it would on its own possibly stop working the verification and make an effort to reroute to previous action, winding up in an unlimited loophole.


You needs to regularly elucidate the model arguments of your type featuring activities to disregard recognition, or you could find yourself along witha limitless loophole on failing verification.

Furthermore, it is actually additionally possible to execute extra validators merely for details activity arguments making use of @Flow \ Validate inside a controller activity:

It is actually likewise feasible to incorporate an additional validator for a sub object of the disagreement, using the ” dot-notation “: @Flow \ Validate( argumentName=" comment.text", type=" ...")