Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Event on buttons of messagebox alert in designer

Avatar

Former Community Member

Hi All,

How to write an event on the buttons of message box alert in designer?

xfa.host.messageBox("Enter Number","Validation",1,2);

This will prompt an alert.

"Enter Number" will be the comment.

"Validation" will be the title bar.

"1" means we are using warning as an alert

"2" means we are going to have 2 (Yes/No) buttons in alert box.

Please someone help me out to write an event on the (Yes/No) buttons.

If someone click on the yes then it should have done some  actiity and No then other set of activity.

Regards

Abhishek

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi,

if you add a variable the xfa.host.massageBox call returns the button that was pressed.

for example

var retFromBox = xfa.host.messageBox("Enter Number","Validation",1,2);

the retFromBox variable will be one of the following

  • 1 (OK)
  • 2 (Cancel)
  • 3 (No)
  • 4 (Yes)

Hope this helps

Malcolm

View solution in original post

5 Replies

Avatar

Correct answer by
Level 5

Hi,

if you add a variable the xfa.host.massageBox call returns the button that was pressed.

for example

var retFromBox = xfa.host.messageBox("Enter Number","Validation",1,2);

the retFromBox variable will be one of the following

  • 1 (OK)
  • 2 (Cancel)
  • 3 (No)
  • 4 (Yes)

Hope this helps

Malcolm

Avatar

Former Community Member

Hi Malcolm,

Thanks for your quick reply. I am able to write event on the button click of messagebox.

Can i able to creae my own customized button in this message box?

Consider if i want to create two buttons in message box "Ok" and "Edit" is it possible with live cycle designer?

Regards

Abhishek

Avatar

Level 5

Hi,

No the messagebox is limited to what is in the help.

If you are creating a PDF ( viewed in Acrobat or Adobe Reader) then you could  create your own dialog to do this,  to create your own dialog you would have to use the Acrobat JS Guide, specifically the "app.execDialog" function, but this is fairly complex and requires a lot more coding than xfa.host.messageBox.

The Acrobat JavaScript guide is here if you want to investigate further

http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_AcroJS.88.136.html

Hope this helps

Malcolm

Avatar

Level 10

Hi,

Another way to easily use the execDialog method is to use a very handy Acrobat plugin from WindJack Solutions: AcroDialog  http://windjack.com/product/acrodialogs/

Whatever, dude.png

I use it all the time for custom dialogs.

Niall

Avatar

Level 2

Hi Niall,

Is there a way to have just one OK button and the 'X' button to close the window? I tried with all combinations and i see that only when you have "OK" and "Cancel" OR "Yes", "No" and "Cancel" options(that is -  xfa.host.messageBox("Hello World!",3,1); or  xfa.host.messageBox("Hello World!",3,3);) is when u get the 'X' button to close.

I have a popup with a long message content which should just have one "OK" button. But since the message content is long, it is difficult to accommodate the "OK" button well within the monitor screen size.

Hence i am having to give - xfa.host.messageBox("Hello World!",3,1) so that i have the "X" button to either click or press "Esc" to close the popup.

Requirement is such that i need only "OK" button with the "X" option. The only action on clicking any of these will just be to close the popup.

Any help will be highly appreciated.

Thanks,

Radhika Magaji