Skip to Content
0
May 06, 2016 at 12:30 PM

Set up messageBox type conditionally.

31 Views

How do I set the type of message box based on a variable?

For example I have a warning message box...

MessageBox.warning("My Message", {

.........

}):

But, say for example I only want to display a warning message box if a variable 'warning' is true, otherwise create a confim message box.

if (warning){

MessageBox.warning("My Message", {

.........

}):

}

else

{

MessageBox.confirm("My Message", {

.........

}):

}

However the above code is totally unmanageable as the body of the message contains a lot of code.

What else can I do?