Expand my Community achievements bar.

How to change appearance of xfa.host.messagebox

Avatar

Former Community Member

    Is there anyway to apply a different look to the xfa.host.messagebox ?  It is pretty, um what is the word ..... -- ugly. That is the word

Any help would be very appreciated.

Thanks

8 Replies

Avatar

Former Community Member

It is leveraging the response object in javascript. You will have access to all of the strings (i.e. title, buttons, message, etc..) but we do not expose the "look" of the message.

Paul

Avatar

Level 10

Hi,

Check out AcroDialog at www.windjack.com

You can create dialogue boxes (and message boxes) while in Acrobat and then copy the Javascript from AcroDialog into a click event of a button in LC Designer. Works a treat and you can include images and logos, etc.

Good luck,

Niall

Avatar

Former Community Member

Sorry, I'm a bit late here, but how do you create dialog boxes in Acrobat?

I can't get onto the website you mentioned - if someone could briefly explain, I'd be very happy

Thanks,

Josh.

Avatar

Level 10

Hi,

The url that Steve gave above takes you to the Help file for LC Designer.

You put the messageBox line within your script when you want to alert the user to something or to give them a choice. for example you could put the script within a calculate event to let the user know the value of a hidden variable:

xfa.host.messageBox("This is a message", "This is a title", 3, 1);

The help file sets out the four different options for the last two parameters (which can be used in any combination).

xfa.host.messageBox("This messageBox uses:\n\nParameter 3 = 1 (Warning) and Parameter 4 = 1 (OK, Cancel)", "Hello World!", 1, 1);

The "\n" will insert a return (new line).

13-05-2009 07-45-09.png

Scripting for additional features within a dialogue window can be achieved using the Javascript Dialog Object; however this is getting quite advanced. The AcroDialog product from Windjack Solutions does make this process easier.

The messageBox returns a number depending on which button the user clicks:

Returns 1 if the user clicks OK;

Returns 2 if the user clicks Cancel;

Returns 3 if the user clicks No;

Returns 4 if the user clicks Yes;

On this basis you can script actions depending on which button the user clicks in your messageBox, by asigning the returning value to a variable and then looking at the value of the variable. For example in the click event of a button on the form:

var nButton = xfa.host.messageBox("You are about to delete this row.\n\nDo you want to continue?", "DELETE ROW", 3, 2);

if (nButton == 4) // Hitting the Yes button returns 4

{

     _dyndetail.removeInstance(this.parent.index); // proceed with delete

}

The above deals with LiveCycle Designer. If you are scripting exclusively in Acrobat then you could use the app.alert(); method, to display your message.

Hope this helps,

Niall

Avatar

Former Community Member

Sorry Niall,

I should have explained myself more clearly - I meant the link you referred to (www.windjack.com).

I really wanted an explanation of "AcroDialog" which you mentioned - it looks interesting. Is it something you can do in Acrobat? I've searched adobe's website for it, but with no results.

Thanks for the info above, anyway - it is helpful!

Josh

Avatar

Level 10

Hi Josh,

No problem. I am out at the moment so I am not sure about references. The Dialog Object is a part of Acrobat and is detailed in support documentation (API or SDK or ...). So you can script advanced dialogue windows from scratch (I haven't done this).

AcroDialog is completely separate from Adobe. It is an Acrobat plug-in which you can purchase from Windjack Solutions. It uses the Acrobat Dialog Object and creates a simple drag and drop approach to creating the dialogue with minimal scripting. I think you can download a trial from www.windjack.com

When you have it installed, it is accesed via a button from within Acrobat (just thought of something I think you will need Acrobat v7 or above). When the plug-in is launched, you develop and test your dialogue and when finished copy the Javascript back into LC Designer or Acrobat. The script can be included in a button, calculation or validation or whatever.

Hope that helps,

Niall

Avatar

Former Community Member

Hello Niall,

That does help - thanks very much

Josh.