# Custom Validator for Compounds (v13.1 upgrade)

**URL:** <https://community.bloomreach.com/t/custom-validator-for-compounds-v13-1-upgrade/1226>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [July 5, 2019, 1:19pm UTC](https://community.bloomreach.com/t/custom-validator-for-compounds-v13-1-upgrade/1226 "2019-07-05T13:19:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesper\_Volkers](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jesper_volkers/32/146_2.png) [@Jesper\_Volkers](https://community.bloomreach.com/u/Jesper_Volkers)\
**Post date:** [July 5, 2019, 1:19pm UTC](https://community.bloomreach.com/t/custom-validator-for-compounds-v13-1-upgrade/1226/1 "2019-07-05T13:19:34Z")

</div>

Hi there,

I’m currently upgrading our project from 13.0 to 13.1 so I walked through the steps and one of them was about the custom validators. This change seems to cause a little problem. The problem I’m facing is that validating compounds became less user friendly. Let me explain my situation with a little example.

We have a document type `ContentDocument` this document contains multiple fields, one of them is the `mainContent` consisting out of content blocks. One of those content blocks is the `list` compound with multiple `item` compounds.

```auto
ContentDocument
---- mainContent 
---------- list
---------------item
---------------item
---------------item

```

The business requires at least 4 items in each `list`. Therefore we created a `MinimalSizeValidator`.  
Before the upgrade, this validator was attached to the `mainContent` property of `ContentDocument`. Although, since the upgrade this does not work as it did before. So I tried some other ways to make it work. My current ‘best’ solution is placing the validator on the `list` compound instead and giving it the scope ‘document’. This will show my customized error message on top of the document, although up to 3 times, because it does it for each `item` and it doesn’t highlight the exact field. When going for ‘field’ scope, it will still do the correct validation, although it wont show my customized message and it’s a big guess for the editor what is wrong.

I hope my issue is clear. Looking forward to suggestions on how to improve the user experience here for the cms editors. I’ve already read the documentation on custom validators ([https://documentation.bloomreach.com/library/concepts/plugins/create-a-custom-field-validator.html](https://documentation.bloomreach.com/library/concepts/plugins/create-a-custom-field-validator.html)). But I could not find any further help there.

Greetings,  
Jesper

---

<div class="post-metadata">

**Author:** ![Jesper\_Volkers](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jesper_volkers/32/146_2.png) [@Jesper\_Volkers](https://community.bloomreach.com/u/Jesper_Volkers)\
**Post date:** [July 8, 2019, 8:27am UTC](https://community.bloomreach.com/t/custom-validator-for-compounds-v13-1-upgrade/1226/2 "2019-07-08T08:27:25Z")

</div>

After upgrading to v13.2 it works again, I’m not sure why there is nothing mentioned about the custom validators in the release notes. But apparently something chanced what made it work again.

---

<div class="post-metadata">

**Author:** ![jeroen.hoffman](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jeroen.hoffman/32/43_2.png) [@jeroen.hoffman](https://community.bloomreach.com/u/jeroen.hoffman)\
**Post date:** [July 9, 2019, 8:38am UTC](https://community.bloomreach.com/t/custom-validator-for-compounds-v13-1-upgrade/1226/3 "2019-07-09T08:38:28Z")

</div>

Thanks for the follow-up Jesper, not sure what the 13.1 issue was.

Note that 13.3 is around the corner and it supports new types of validators for fields, compounds and documents, with feedback messages on those levels.

Jeroen
