Search
WindowHost.showInputDialog Method
See Also
 






Shows an input dialog.

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

 Syntax

JavaScript  Copy Code

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

 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.

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.

 Example

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

JavaScript  Copy Code

// Show a input dialog.
// The input dialog displays a message, OK and Cancel buttons, and an input. You can provide a custom input and specify the value of which of its properties will be passed as an argument to the callback function.
ui.Dialogs.showInputDialog("Input", "Please enter a new value for the data field", inputCallback.bind(sender));

// This is the callback function of the input dialog.
// The first parameter stores the modal result of the dialog (e.g. which button was pressed).
// The second parameter stores the value result of the dialog (e.g. what is the value of the input).
function inputCallback(result, value)
{
 if (result == ui.ModalResult.OK)
 {
  this.data = value;
  this.element.querySelector("#data").value = value;
 }
}

 See Also