Errors from ValidationRules are always global

Hi!

I have a class implementing ValidationRuleBase<Page> which returns errors based on field values.

I’m trying to do pretty much the same as in this example from the education: https://github.com/LitiumAB/Education/blob/master/Developer%20Education/Tasks/Validation/Resources/ValidateBookAuthor.cs

The only thing required to get field by field validation is to pass the field-id as first argument to add error. For whatever reason all my errors gets global (as in the “*” example in the ValidateBookAuthor example). How can this be? Is there a any way I can debug what might be wrong? I have compared the id’s of the field both in the database and in Litium backoffice and everything seems to be correct.

Litium version: [7.4.3-patch-2009172214]

Does the casing of the field id match on the input field?

Sounds like it could be something similar to this discussion: Validate on specified field and display specific error message

Awesome. I will try the suggestions from that post! Thank you!

Okay, so the solution was two folded as described in the other post. Validation should be performed on “DraftPage” and the Id should be passed as camel case. All good, thank you Nils!

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.