closeDialog: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{stub}}
{{MacroFunction
{{MacroFunction
|name=closeDialog
|name=closeDialog
|version=1.3b49
|version=1.3b49
|description=Closes the specified macro dialog.
|description=Closes the specified macro dialog that has previously been created using [[dialog | {{code | [dialog():]}}]]. If the
[[dialog]] is not open then the function has no effect.  


The most common use for this function is closing a [[dialog]] based from a macro that is run when clicking on a link or button for the
[[dialog]] that has no close button.
|usage=
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
Line 13: Line 15:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: closeDialog("CharacterSheet")]   
[h: closeDialog("CharacterSheet")]   
</source>
Assuming a [[dialog]] called "Name Entry" has been created without the input flag but containing a form. In the macro called when the
form is submitted you can use the following logic to check that the "name" field is not blank and close the [[dialog]].
<source lang="mtmacro" line>
[h, if(listGet(macro.args, "name")), code: {
    [closeDialog("Name Entry")]
} ; {
    <!-- otherwise we would do something here to tell the user to provide a name -->
}]
</source>
</source>
}}
}}
[[Category:Dialog Function]]
[[Category:Dialog Function]]

Revision as of 12:55, 26 March 2009

closeDialog() Function

Introduced in version 1.3b49
Closes the specified macro dialog that has previously been created using [dialog():]. If the

dialog is not open then the function has no effect.

The most common use for this function is closing a dialog based from a macro that is run when clicking on a link or button for the

dialog that has no close button.

Usage

[h: closeDialog(name)]

Example

[h: closeDialog("CharacterSheet")]

Assuming a dialog called "Name Entry" has been created without the input flag but containing a form. In the macro called when the form is submitted you can use the following logic to check that the "name" field is not blank and close the dialog.

[h, if(listGet(macro.args, "name")), code: {
    [closeDialog("Name Entry")]
} ; {
    <!-- otherwise we would do something here to tell the user to provide a name -->
}]