Expand my Community achievements bar.

SOLVED

Inline editing dialog validation

Avatar

Level 4

Hi

 

I'd like to do the validation while saving content via inline editing. Could you please share if it'd be possible to do so and how?

 

I'm using AEM 6.2

 

Thanks,
Vijay

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@vijayk87714775,

What kind of validation are you referring to? Is this for the richText editor, inline-editing? Please be more detailed in your requirements and goals.

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

@vijayk87714775,

What kind of validation are you referring to? Is this for the richText editor, inline-editing? Please be more detailed in your requirements and goals.

Avatar

Level 4
@BrianKasingli Yes, it's for rich-text editor with inline editing. Here I am trying to do a validation for a specific url domain. If the user enters the wrong domain and tries to save the dialog using the inline eidtor then I am not seeing any validation is happening , but If use the wrench icon and author , Validation works fine.

Avatar

Community Advisor

Hmm, it might easier for your development implementation if you only allow this rich-Text field to only be edited in the Touch UI editor. Once the user saves the dialogue changes, either an alert or an error message will be shown to the user, and not allowing the dialogue to be saved.

 

You can achieve this with the Granite UI Validation API.

 

A short and sweet example can be found here, where it examples how the multifield is validated when attempted to be saved. 

https://blogs.perficient.com/2018/10/26/simple-multifield-max-item-validation-for-aem-6-4/

 

 

 

$(window).adaptTo("foundation-registry").register("foundation.validation.validator", {
  selector: "[data-foundation-validation^='validate-url']",
  validate: function(el) {

    // validate will be invoked, every time when the dialogue is being saved.
    // validate logic uses JQUERY to get dialogue values from the Granite UI.
    // return false to dis-allow saving.
    // return true to allows saving.

     return isValidationCorrect($(el).text());
  }
});

function isValidationCorrect(text) {
    ...
}

 

 

 

Avatar

Community Advisor

Hi @vijayk87714775 

Could you please check below links:

 

Regards,

Arpit

Avatar

Level 4
@ArpitVarshney thanks for the links but these validation doesn't apply on rich text inline editing and that's what I'm looking for.