# Use of dynamic validation via Validator with FormHelper CakePHP 3.x

**URL:** <https://discourse.cakephp.org/t/use-of-dynamic-validation-via-validator-with-formhelper-cakephp-3-x/3293>\
**Category:** Need Help\
**Created:** [September 28, 2017, 9:30pm UTC](https://discourse.cakephp.org/t/use-of-dynamic-validation-via-validator-with-formhelper-cakephp-3-x/3293 "2017-09-28T21:30:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomcowle](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tomcowle](https://discourse.cakephp.org/u/tomcowle)\
**Post date:** [September 28, 2017, 9:30pm UTC](https://discourse.cakephp.org/t/use-of-dynamic-validation-via-validator-with-formhelper-cakephp-3-x/3293/1 "2017-09-28T21:30:33Z")

</div>

I am creating a ‘form editor’ in CakePHP.

The interface allows the user to choose validations to apply to the fields, e.g. Numeric, Email etc.

As such I need to dynamically create validation for the model based on the user input. For this I can use the Validation object: [https://book.cakephp.org/3.0/en/core-libraries/validation.html](https://book.cakephp.org/3.0/en/core-libraries/validation.html)

I want to take advantage of the features of FormHelper, for example, automatically outputting error messages for fields.

I can see how to use a hard-coded validator from the model to do this by setting the validator in the context option for Form-\>create() - but how do I use a custom $Validator object which has been dynamically created?

Clarification: I am creating the validation object in the controller as I need to use a url parameter to load the correct configuration. I just don’t see how to get the table to use my dynamically created Validator object.
