Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

OOBT page create button

Avatar

Level 2

page create button its id is update in service pack 18 to coral-id-12 from 11.
now it is causing the issue on logics implemented by using coral-id.
next time onwards we have to avoid this kind of issue. is there any solution for this?
any OOTB validator we have for this other than Submit?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @SudarshanV1 
Which create button are you talking about? create button at page property. If yes then you can write a validation on form submit event.

 

Example :

 

document.querySelector(".cq-siteadmin-admin-createpage").addEventListener("submit", function(e){
    if(!isValid){
        e.preventDefault();    //stop form from submitting
    }
});

 

Another way could be using selector based on button type

.coral3-Button[type="submit"]



Arun Patidar

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hi @SudarshanV1 
Which create button are you talking about? create button at page property. If yes then you can write a validation on form submit event.

 

Example :

 

document.querySelector(".cq-siteadmin-admin-createpage").addEventListener("submit", function(e){
    if(!isValid){
        e.preventDefault();    //stop form from submitting
    }
});

 

Another way could be using selector based on button type

.coral3-Button[type="submit"]



Arun Patidar

Avatar

Level 5

Hi @SudarshanV1 ,

You should not write your logics based on coral-id- , since it can change based on the number of coral items on the page or a dashboard - sites dashboard in your case, you should instead target a specific class which is only for the create button e.g. granite-collection-create and restrict the functionality by path.

Or rather overlay the functionality altogether so that in future you have more control over the button.

anupampat_0-1721818210726.png

Regards,

Anupam

 

Avatar

Level 2

is there any documentation for this to target class instead of id?
if yes can you share me pls