# Validate on specified field and display specific error message

**URL:** <https://forum.litium.com/t/validate-on-specified-field-and-display-specific-error-message/1572>\
**Category:** Questions\
**Tags:** litium-7\
**Created:** [July 27, 2020, 9:34am UTC](https://forum.litium.com/t/validate-on-specified-field-and-display-specific-error-message/1572 "2020-07-27T09:34:40Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Artur](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/artur/32/948_2.png) [@Artur](https://forum.litium.com/u/Artur)\
**Post date:** [July 27, 2020, 5:19pm UTC](https://forum.litium.com/t/validate-on-specified-field-and-display-specific-error-message/1572/9 "2020-07-27T17:19:10Z")

</div>

Hm, I wonder if this is some kind of casing issue;  
Tried to replicate this again and suddenly it started working on the new fields but not on the one i want it to work on.

Here is a testcase.  
3 fields, Custom, CCustom, CCCustom.  
Then i add 3 errors on all of them.  
Look how it will display error only on the first 2

Constants

```auto
public const string CustomId = "CustomId";
public const string CCustomId = "CCustomId";
public const string CCCustomId = "CCCustomId";

```

Definition

```auto
new FieldDefinition<WebsiteArea>(PageFieldNameConstants.CustomId,SystemFieldTypeConstants.LimitedText){ MultiCulture = false},
new FieldDefinition<WebsiteArea>(PageFieldNameConstants.CCustomId,SystemFieldTypeConstants.LimitedText){ MultiCulture = false},
new FieldDefinition<WebsiteArea>(PageFieldNameConstants.CCCustomId,SystemFieldTypeConstants.LimitedText){ MultiCulture = false},

```

Validation

```auto
validationResult.AddError(PageFieldNameConstants.CustomId, $"error custom");
validationResult.AddError(PageFieldNameConstants.CCustomId, $"error custom");
validationResult.AddError(PageFieldNameConstants.CCCustomId, $"error custom");

```

See that the last one does not trigger.  
Tried to change the order of AddError just to be sure and it seems that it’s some casing issue. Tried ToLower() on all then none of them will trigger, maybe thats why the Test did not work. But this seems to be reproducable consistently.

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

Result onsave

```auto
{
    "message": "The request is invalid.",
    "modelState": {
        "$type": "System.Web.Http.HttpError, System.Web.Http",
        "ccCustomId": {
            "$type": "System.String[], mscorlib",
            "$values": ["error custom"]
        },
        "cCustomId": {
            "$type": "System.String[], mscorlib",
            "$values": ["error custom"]
        },
        "customId": {
            "$type": "System.String[], mscorlib",
            "$values": ["error custom"]
        }
    }
}

```

---

_[View the full topic](https://forum.litium.com/t/validate-on-specified-field-and-display-specific-error-message/1572)._
