Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Apr 20, 2021 Apr 20, 2021

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
2.1K
Translate
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
Community Expert ,
Apr 21, 2021 Apr 21, 2021

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...

Translate
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
Community Expert ,
Apr 21, 2021 Apr 21, 2021

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.pngexpand image


PDF Acrobatic, InDesigner & Photoshoptographer
Translate
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

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.

Translate
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
Community Expert ,
Apr 21, 2021 Apr 21, 2021

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.

Translate
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

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.

Translate
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
Community Expert ,
Apr 21, 2021 Apr 21, 2021

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.

Translate
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

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

Translate
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
Community Expert ,
Apr 21, 2021 Apr 21, 2021
LATEST

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

Translate
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
Community Expert ,
Apr 21, 2021 Apr 21, 2021

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

😉


PDF Acrobatic, InDesigner & Photoshoptographer
Translate
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