The CreatorCon Call for Content is officially open! Get started here.

How to confirm a confirm modal in client script in UI Builder

shanker1
Giga Guru

Hi,

Can anyone please on the below use case:-

I want to call a confirm modal in the on submit button of risk workspace.

The modal should have a Yes or No button

On click of Yes, the page should get submitted.

On No, I've to populate a message alert to the user.

 

I've configured the modal confirm. But I want this to be called from within the UI page client script, rather than at the event handler. 

 

Please suggest

 

Thanks!

7 REPLIES 7

Dibyaratnam
Tera Sage

You want it to open from UI builder client script? Your question is not clear. you have also mentioned, you want to call it from UI page client script. can you share the screenshot of the page and where is the button.

shanker1
Giga Guru

I was able to achieve showing up a confirm dialog in the submit (client script) of risk workspace main by the below code,

            const openModal = helpers.modal.open;
            openModal("[component-id$='confirm_1']", {
                size: 'sm'
 
But i;ve a challenge, when the above pop up shows up. The script doesn;t pause when the pop up is there. Instead it executes the complete script. Any suggestion please to pause until the user interacts with the confirm dialog?

Dibyaratnam
Tera Sage

Have you written the entire code inside the same submit client script. that will not work. 

You have to write different script and bind that script with the confirm or cancel buttons available in the modal.