Expand my Community achievements bar.

SOLVED

Either throw MESSAGE or display POPUP?

Avatar

Level 8

Hello

I am trying to give an INFORMATION message by using the below Java Script, but its giving ERROR message ('X' with RED circle) kind of popup/display

xfa.host.messageBox("You are all set - Good to Go");

I guess, below also will not work!

app.alert("You are all set - Good to Go")

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The default is to show the error icon, to show other icons you must use the third parameter of the messageBox method, as in the example below.

var MessageBox = { Icon : { Error : 0, Warning : 1, Question : 2, Status : 3 },
                   Buttons : { Ok : 0, OkCancel : 1, YesNo : 2, YesNoCancel : 3 },
                   ButtonPressed : { Ok : 1, Cancel : 2, No : 3, Yes : 4 }
     };
    
xfa.host.messageBox("You are all set - Good to Go");
xfa.host.messageBox("You are all set - Good to Go", "Message Box Title", MessageBox.Icon.Status, MessageBox.Buttons.Ok);

I have used a JavaScript object (which I normally define in a script object fragment) to define the third, fourth and result of this method so I can avoid magic numbers in my code but you could also code,

xfa.host.messageBox("You are all set - Good to Go", "Message Box Title", 3, 0);

The second parameter becomes the title of the messagebox.

Regards

Bruce

View solution in original post

3 Replies

Avatar

Level 7

Hi,

Be sure script is on correct object/event. Be sure that the object is "visible". If you don't find problem, test using formCalc, to see what error message you get.

Good luck!

Stephen

Avatar

Correct answer by
Level 10

Hi,

The default is to show the error icon, to show other icons you must use the third parameter of the messageBox method, as in the example below.

var MessageBox = { Icon : { Error : 0, Warning : 1, Question : 2, Status : 3 },
                   Buttons : { Ok : 0, OkCancel : 1, YesNo : 2, YesNoCancel : 3 },
                   ButtonPressed : { Ok : 1, Cancel : 2, No : 3, Yes : 4 }
     };
    
xfa.host.messageBox("You are all set - Good to Go");
xfa.host.messageBox("You are all set - Good to Go", "Message Box Title", MessageBox.Icon.Status, MessageBox.Buttons.Ok);

I have used a JavaScript object (which I normally define in a script object fragment) to define the third, fourth and result of this method so I can avoid magic numbers in my code but you could also code,

xfa.host.messageBox("You are all set - Good to Go", "Message Box Title", 3, 0);

The second parameter becomes the title of the messagebox.

Regards

Bruce

Avatar

Level 7

Hi srinivas1506,

I thought you said it didn't work and you were not getting an error message. Your, question makes sense now. Good answer BR001.

Best,

Stephen