Answers.Body: <p>Yii 2 (which is what Craft 3 is built upon) has similar looking form/model validation:</p>
  
  <p><a href="https://www.yiiframework.com/doc/guide/2.0/en/input-validation" rel="nofollow noreferrer">https://www.yiiframework.com/doc/guide/2.0/en/input-validation</a></p>
  
  <p><a href="https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators" rel="nofollow noreferrer">https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators</a></p>
  
  <p>You can also look at how Craft does it in its own <a href="https://github.com/craftcms/cms/tree/develop/src/models" rel="nofollow noreferrer">models</a> and <a href="https://github.com/craftcms/cms/tree/develop/src/controllers" rel="nofollow noreferrer">controllers</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-20T00:35:08.887Z
Answers.LastActivityDate: 2019-01-20T00:35:08.887Z
Answers.UserDisplayName: Brad Bell
Body: <p>Is there anything with craft like <a href="https://laravel.com/docs/5.7/validation#creating-form-requests" rel="nofollow noreferrer">Laravel's Form Requests</a>?</p>
  
  <p>I am writing a plugin with a custom entry type. Right now, I am doing the store/edit pages and I do not want to reinvent the wheel ;)</p>
  
  <p>Is there any way in craft/yii to easily validate the submitted values from a post request? Or what is the <em>best practice</em> in this case for craft?</p>
  
Tags: <plugin-development><craft3><form><validation>
Title: How to validate a form request
ThreadText: # How to validate a form request
  
  (Asked by: username_0 on 2019-01-16)
  
  Is there anything with craft like [Laravel's Form Requests](https://laravel.com/docs/5.7/validation#creating-form-requests)?
  
  I am writing a plugin with a custom entry type. Right now, I am doing the store/edit pages and I do not want to reinvent the wheel ;)
  
  Is there any way in craft/yii to easily validate the submitted values from a post request? Or what is the *best practice* in this case for craft?
  
  **Tags:** plugin-development, craft3, form, validation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-01-20. Score: 1
  
  Yii 2 (which is what Craft 3 is built upon) has similar looking form/model validation:
  
  <https://www.yiiframework.com/doc/guide/2.0/en/input-validation>
  
  <https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators>
  
  You can also look at how Craft does it in its own [models](https://github.com/craftcms/cms/tree/develop/src/models) and [controllers](https://github.com/craftcms/cms/tree/develop/src/controllers).
  
  
  ---
  
  