Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

AEM 6.2 TOUCH UI Validators

Avatar

Level 5

We have implemented both inline and on-submit validators in AEM 6.2

We are now facing an issue with Rich Text editors and validators.

Has anyone got this to work.  We can validate multifields, text areas, text fields, on submit, radio buttons etc .... but have not been successful in implementing validators for Rich Text Editors.

References I've used to this point ...

https://docs.adobe.com/docs/en/aem/6-1/ref/granite-ui/api/jcr_root/libs/granite/ui/components/founda...

http://keysandstrokes.info/aem-touch-ui-richtext-validations/

http://keysandstrokes.info/aem-6-2-touch-ui-validations/

http://experience-aem.blogspot.com/2015/08/aem-61-support-required-property-on-richtext-editor-rte-o...

 

Any help is appreciated.

Thanks,

-Dean

3 Replies

Avatar

Level 5

Since the RTE uses a hidden input field you cannot use that as a selector.  If you use the RichText div and the form it still doesn't work.  Here is an example of the validator:

It never reaches the alert or the "Testing" code.

-Dean

 

~/* ==========================================================================================
 * jQuery-based validators (Touch-optimized UI)
 * ==========================================================================================
 */
(function(document, $, Granite) {
    "use strict";
   
    var summaryField = "form div.coral-RichText-editable.coral-Form-field.coral-Textfield.coral-Textfield--multiline.coral-RichText.is-edited.webkit.chrome";

    $.validator.register({
        selector: (summaryField),        
        validate: function() {

         alert('Testing');
         if (1 == 1) {
          return "Testing";
         }

        }
    });

})(document, Granite.$, Granite);