Dialog.simple (class)
Implements a flexible dialog with the items needed for the plain dialogs Dialog.alert(), Dialog.confirm() and Dialog.prompt(). Of course, you can also create other dialogs with it.
Constructors
- initialize
- Default constructor method. Simply passes the parameter through to the superclass'.
- Parameters: object: options (optional)
- Please see Dialog.core.initialize() for a description of the parameters.
Public Methods
- show
- Shows the actual dialog with msg being the dialog message, passed as the first parameter
- Parameters: String: msg (required), object: options (optional)
- Returns: void
- options may contain any of the following named parameters:
Possible properties for the options parameter object Property Type Description Default title String The dialog title Dialog detail String A longer, more informative text. Usually rendered with a smaller font. null input String If present, a text input field is rendered, with the passed string text as preset value. null button0 String If present, the cancel- (negative answer) button is rendered. The passed string sets the button text. null button1 String If present, the default- (positive answer) button is rendered. This is also the default button whcih will be activated by pressing the return key. The passed string sets the button text. OK button2 String If present, the tertiary button (usually a 'help'-button or similar) is rendered. The passed string sets the button text. null onCancel function Callback function that will be triggered when the dialog is cancelled (e.g. by a click on button0 or the close box). For more information, see Callbacks.
Parameters: dlg: Dialog.simple Object.null onConfirm function Callback function that will be triggered when the dialog is confirmed (usually by a click on button1). For more information, see Callbacks.
Parameters: dlg: Dialog.simple Object.null onOtherButton function Callback function that will be triggered when the tertiary button (usually 'help') is klicked. For more information, see Callbacks.
Parameters: dlg: Dialog.simple Objectnull - In addition, the options object can contain any parameter that is available for Dialog.core.show().
- Note:
The callback functions onLoad and onButtonClick, while available for overriding, are predefined here and contain important functionality. If you want to replace this functions, please make sure to replicate what they do.
- getText
- If the dialog contains a the text input field, this method can be used to retrieve the current value of this field. Otherwise, null is returned.
- Parameters: none
- Returns: String
- cancel
- First runs the onCancel callback, then hides the dialog, unless told not to.
- Parameters: none
- Returns: void
- confirm
- To be called when the confirm button (button1) has been pressed (or you want to confirm otherwise). Will first check the onConfirm callback before closing the dialog.
- Parameters: none
- Returns: void
- otherButton
- To be called when the 'other' button (button2) has been pressed. Will first check the onOtherButton callback before closing the dialog.
- Parameters: none
- Returns: void
Protected Properties
- _form
- Keeps a reference to the <form>-Element that is contained in the dialog.
- Type: Form Element Object
References
- Superclass
- – Dialog.core is the superclass of Dialog.simple: