<p>If your validation rules are truly custom and aren't covered by the default Craft validation rules, the only way I can think of getting them into the Guest Entries <code>EntryModel</code> is to fork the plugin and add your own <code>MyPluginEntryModel</code> that extends <code>EntryModel</code> adding a <code>rules</code> method with your custom validation logic.</p>

<p>Read <a href="http://www.yiiframework.com/wiki/168/create-your-own-validation-rule/" rel="nofollow">here</a> for more details on that.</p>

CC BY-SA 3.0
2015-09-10T19:42:24.167Z
I found this question really helpful with adding custom validation in a plugin scenario: http://craftcms.stackexchange.com/a/10163/643
Alec Ritson
CC BY-SA 3.0
2015-09-10T17:23:14.203Z
2015-09-10T17:23:14.203Z
Brad Bell
<p>What would be the best way to add some custom validation rules on forms submitted on the front-end without using specific field types for it?</p>

<p>I'm using the <a href="https://github.com/pixelandtonic/GuestEntries" rel="nofollow">Guest Entries</a> plugin that allows anonymous posts to the targeted section.  I'm new to Yii and Craft CMS and I cannot seem to find a way to extend the validation rules for the <a href="http://buildwithcraft.com/classreference/models/EntryModel" rel="nofollow">EntryModel</a> (at least I suspect it needs to get done there). </p>

<form><validation>
Custom validation rules on frontend form
# Custom validation rules on frontend form

(Asked by: username_0 on 2015-09-10)

What would be the best way to add some custom validation rules on forms submitted on the front-end without using specific field types for it?

I'm using the [Guest Entries](https://github.com/pixelandtonic/GuestEntries) plugin that allows anonymous posts to the targeted section. I'm new to Yii and Craft CMS and I cannot seem to find a way to extend the validation rules for the [EntryModel](http://buildwithcraft.com/classreference/models/EntryModel) (at least I suspect it needs to get done there).

**Tags:** form, validation


---

## 1 answers

### Answer by username_1 on 2015-09-10. Score: 1

If your validation rules are truly custom and aren't covered by the default Craft validation rules, the only way I can think of getting them into the Guest Entries `EntryModel` is to fork the plugin and add your own `MyPluginEntryModel` that extends `EntryModel` adding a `rules` method with your custom validation logic.

Read [here](http://www.yiiframework.com/wiki/168/create-your-own-validation-rule/) for more details on that.

> **Comments:**
> **username_2**: I found this question really helpful with adding custom validation in a plugin scenario: http://craftcms.stackexchange.com/a/10163/643  

---

