# Field validation

**URL:** <https://forum.litium.com/t/field-validation/866>\
**Category:** Questions\
**Tags:** accelerator, litium-7\
**Created:** [May 16, 2019, 3:36pm UTC](https://forum.litium.com/t/field-validation/866 "2019-05-16T15:36:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gonzalo](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@Gonzalo](https://forum.litium.com/u/Gonzalo)\
**Post date:** [May 16, 2019, 3:36pm UTC](https://forum.litium.com/t/field-validation/866/1 "2019-05-16T15:36:57Z")

</div>

I created a multifield as showed below, but i would like to have validation for my socialMediaLink (that is defined as a string). So when the user press save on entered data it would regex validate the string as an url.  
new FieldDefinition(“SocialMedia”, SystemFieldTypeConstants.MultiField)  
{  
Localizations =  
{  
[“sv-SE”] = {Name = “Social Media” },  
},  
CanBeGridColumn = false,  
CanBeGridFilter = true,  
Option = new MultiFieldOption  
{  
IsArray = true,  
Fields = new List()  
{  
“SocialMediaIcon”,  
“SocialMediaIconText”,  
**"SocialMediaIconLink"**  
}  
}  
}

Litium version: 7.2

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [May 17, 2019, 6:54am UTC](https://forum.litium.com/t/field-validation/866/2 "2019-05-17T06:54:55Z")

</div>

You can add validation so that when the entity is saved, it will check that the field contains a valid URL and display an error if that’s not the case.  
[https://docs.litium.com/documentation/architecture/validation](https://docs.litium.com/documentation/architecture/validation)

An example can be found in this task from our developer education: [https://github.com/LitiumAB/Education/tree/master/Developer%20Education/Bookstore/Validation](https://github.com/LitiumAB/Education/tree/master/Developer%20Education/Bookstore/Validation)

My guess is that this will be in the CMS, so the entity would either be DraftPage or DraftBlock if you want the error to be shown on Save. Otherwise it will be shown on Publish.
