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.

Custom multifield validation (Aem 6.2)

Avatar

Level 1

Hi,


I'm currently using Aem 6.2.  How do I validate a multifield when I use a Javascript file to validate the component as per this article:

https://helpx.adobe.com/experience-manager/using/classic_dialog_validation.html

As per the article you need to add an "Id" property to your fields if you want to be able to reference them in the backing Javascript file.

Everything works fine as per the article for basic fields, but it seems I can't use that approach to validate a multifield.  Am I mistaken?  Is there maybe an example using a multifield somewhere I can look at?  Are there other ways I can validate a multifield using custom code that is not mentioned in the article?  I'm still using Aem 6.2 and the Classic Ui - but please let me know if there are maybe other supported solutions in newer versions of Aem and I can upgrade

More low-level detail:

                    <params

                        jcr:primaryType="cq:Widget"

                        fieldDescription="Click the '+' to add a new parameters"

                        fieldLabel="Parameters"

                        name="./params"

                        xtype="multifield">

                        <fieldConfig

                            jcr:primaryType="cq:Widget"

                            width="155"

                            xtype="pathfield"/>

                    </params>

I added the "Id" field to my "multifield" node - didn't work.  I then added the "Id" field to the underlying fieldConfig node - I were able to access the first multifield value in the backing Javascript validation, but the component refused to allow me to edit any multifield values beside the first (Gui broken...) - so I think this validation might not have been written to support multifields?

Any insight appreciated

Thank you

3 Replies

Avatar

Level 1

Looks interesting thanks!!  Do these features also exist for Classic UI?

Avatar

Level 10

These are touch ui - in AEM 6.2/6.3 - most of the articles will be for Touch UI - which is not the preferred way to write AEM components.