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
public const string CustomId = "CustomId";
public const string CCustomId = "CCustomId";
public const string CCCustomId = "CCCustomId";
Definition
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
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.
Result onsave
{
"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"]
}
}
}