Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Granite UI Multifield Maximum Items Validation | AEM Community Blog Seeding

Avatar

Administrator

7/20/22

BlogImage.jpg

Granite UI Multifield Maximum Items Validation by Sourcedcode

Abstract

For almost all cases of AEM implementations, adding validation for maximum items for the Granite UI Multifield is a must. In this article, we will put together a script that will register a new validator (foundation.validation.validator) to the foundation-registry (the foundation-registry is used in the Granite UI framework). In this solution, we will be utilizing the jQuery Validation library (the validation library used by Granite UI is achieved by using the jQuery Validation plugin).

We must register a client library specifically targeting the author, which is specific to customizing page authoring, which will inject JavaScript into the context of the page and execute the registry and scripts.

After the installation of this validation code, you should be able to just include two additional properties to the multifield Granite UI component, and it should be validating as expected:
Two fields:
granite:class=”granite-ui-validation-multifield-max-items”
validation=”max-items-2″

Example:

Read Full Blog

Granite UI Multifield Maximum Items Validation

Q&A

Please use this thread to ask the related questions.