Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Granite UI Multifield Maximum Items Validation | AEM Community Blog Seeding

Avatar

Administrator

20-07-2022

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.