OOBT page create button | Community
Skip to main content
Level 3
July 24, 2024
Solved

OOBT page create button

  • July 24, 2024
  • 2 replies
  • 1028 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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"]

2 replies

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
July 24, 2024

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
Level 3
July 24, 2024

thanks this is working

anupampat
Community Advisor
Community Advisor
July 24, 2024

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.

Regards,

Anupam

 

Level 3
July 24, 2024

not this.. while create page after selecting template.