Search
Dialogs.showInputDialog Method
See Also
 






Shows an input dialog, which displays a message, a custom input control and OK and Cancel buttons.

Namespace: MindFusion.Common.UI
File: Dialogs.js

 Syntax

JavaScript  Copy Code

function showInputDialog ([title, [message, [callback, [parentElement, [input, [property, [theme]]]]]]])

 Parameters

title
Optional.

String. The text to display as a dialog title.

message
Optional.

String. The message to display as the dialog text.

callback
Optional.

function. The callback function to invoke when the dialog is closed.The dialog's modalResult will be passed as the first, and the specified property value of the input control will be passed as the second parameter to the callback function.

parentElement
Optional.

HTMLElement. The Dom element to append the dialog to.If the parameter is not specified, the dialog will be appended to document.body.

input
Optional.

HTMLElement. The input control to show in the dialog. If the parameter is not specified, an empty HTML text input will be displayed.

property
Optional.

String. The name of the property of the input control, whose value will be passed as the second argument to the callback function.If the parameter is not specified, the value property will be used.

theme
Optional.

String. The theme of the dialog.

 Example

The following code creates an input dialog with a callback method:

JavaScript  Copy Code

// create a custom input for the input dialog
var select = document.createElement("select");

var option = document.createElement("option");
option.value = 0;
option.innerHTML = "Relaxed";
select.appendChild(option);

option = document.createElement("option");
option.value = 1;
option.innerHTML = "Timed";
select.appendChild(option);

// show the dialog
ui.Dialogs.showInputDialog("", "Choose game mode", startGame, document.getElementById("content"), select, "value");


function startGame(result, mode)
{
 if (result == ui.ModalResult.Cancel) return;
        ...........
        ...........
}

 See Also