How to handle Cancel button to return to a custom dialog from app.alter() choose?

New Here ,
Apr 20, 2021 Apr 20, 2021

Copy link to clipboard

Copied

I made a custom dialog and display it with execDialog() method. This custom dialog has a ok_cancel field. Now I want to let user to choose if he/she really want to exit from this custom dialog by prompt them a Yes_No app.alert dialog.
I already know how to handle some actions when Cancel button is called in that custom dialog, but I do not know how to stop exiting form custom dialog once Cancel action is triggered.

How may I achieve it?

 

Thanks in advance.

TOPICS
How to, JavaScript, PDF forms

Views

199

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

This is not possible, at least not if you use the built-in Cancel button.

In order to do it you would need to create your own "Cancel" button, attach a function to it and then close the dialog if the user clicks Yes in the alert window. However, doing so seems to be the same as clicking on OK, so you would need to use some kind of variable to differentiate between the two operations. In short, not a simple task...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

I'm not sure to really understand your needs, but I already made a custom dialog with YES and NO buttons, where NO is the default.

In this dialog NO (the default) means "do nothing" and YES means "Print".

Could this help you?

 

(NON = NO, OUI = YES)

 

Capture_352.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Yes, I done something similar too. Now, instead of doing nothing, I want to prompt user to confirm if they really want to close that dialog.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

As mentioned by try67, "not a simple task".

 

You may need to reference to the following tutorials by ACP Thom Parker (below) in order to customize your own alerts dialogue boxes with an option to collect responses from the user(s):

 

 

 

 

 

 

These tutorials will provide you with PDF examples that include some of the code that you may need which is available for download.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Thanks for your response.
Actually I have seen his tutorials before, they helped me a lot to achieve what I have already done.


I already call an app.alert() when I press Cancel (or Escape keyboard) in a Custom Dialog (I mean about dialogs discoused in last tutorial you provided, by adding a "cancel:function(dialog){}" function).
I already can get Yes or No response from the previously called app.alert().

The problem is I do not know how return to custom dialog once Cancel function is called.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Ok, in that case share the script that you're currently using or an example of the PDF.

 

This will make it easier for us to assist you.

 

Seems like you may be missing a condition to handle that part.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Okay, sounds good, I will share it then.
Is there a way to update my post? Or should I open a new one?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

LATEST

You may do it here since this is still an ongoing discussion.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

"Now, instead of doing nothing, I want to prompt user to confirm if they really want to close that dialog."

Technical response: Clicking any button means closing the current dialog box before doing anything else, so answer is: not possible.

 

User-friendly experience response: Are you serious?

😉

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines