# Collection Field: Email Validation

**URL:** <https://discourse.getcockpit.com/t/collection-field-email-validation/1299>\
**Category:** General\
**Created:** [March 26, 2020, 4:30pm UTC](https://discourse.getcockpit.com/t/collection-field-email-validation/1299 "2020-03-26T16:30:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![terencejackson8000](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/terencejackson8000/32/641_2.png) [@terencejackson8000](https://discourse.getcockpit.com/u/terencejackson8000)\
**Post date:** [March 26, 2020, 4:30pm UTC](https://discourse.getcockpit.com/t/collection-field-email-validation/1299/1 "2020-03-26T16:30:07Z")

</div>

Hi,

is it possible to add a validation for a field in a collection e.g. to make sure an Email address is entered?

---

<div class="post-metadata">

**Author:** ![serjoscha87](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/serjoscha87/32/151_2.png) [@serjoscha87](https://discourse.getcockpit.com/u/serjoscha87)\
**Post date:** [March 29, 2020, 1:05pm UTC](https://discourse.getcockpit.com/t/collection-field-email-validation/1299/2 "2020-03-29T13:05:37Z")

</div>

Yes, this is possible.

You can pass any html-input-field parameters to the json-options within the cockpit collection config:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/0acb33cdc741444e69c071ddd8586dbd8a0d5be5.png)

this will result in:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/599621abf27ff07ae17fe9898b4eba91d0e67ca3.png)

(so the browser prevents saving the entry because the rule for the e-mail field is not met)

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/d7db2e34bf5ea1e73af807cc0f8698aa07a8e77d.png)

here you can see that the json option has been set to the dom / the input field params

---

<div class="post-metadata">

**Author:** ![terencejackson8000](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/terencejackson8000/32/641_2.png) [@terencejackson8000](https://discourse.getcockpit.com/u/terencejackson8000)\
**Post date:** [March 30, 2020, 10:30am UTC](https://discourse.getcockpit.com/t/collection-field-email-validation/1299/3 "2020-03-30T10:30:12Z")

</div>

Perfect! Thank you very much.

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [March 30, 2020, 11:13am UTC](https://discourse.getcockpit.com/t/collection-field-email-validation/1299/4 "2020-03-30T11:13:18Z")

</div>

Be aware, that this check is only client side. If you use the api or if you instert mail addresses programmatically, you have hook into `collections.save.before` to validate the data.
