AgileApps Support Wiki Pre Release

Difference between revisions of "Functions.showMessage"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 1: Line 1:
{{DISPLAYTITLE:showMessage}}  
{{DISPLAYTITLE:showMessage}}  
:<tt>Functions.showMessage(String key [, String[] args])</tt>
;Description:
;Description:
:*Displays the message in the UI, irrespective of any database insertions or updates (without interrupting the program flow) <noinclude>via the [[Java API]]</noinclude>  
This function displays a message to the user, either at the top of page or in a dialog, depending on the context.
:*Translates the token and displays the [[Custom Label]] in the selected language
 
:;Considerations:
:* The basic version of the function displays a message string.
:* With additional options, a localized version of a message can displayed.
:* The function displays the message in the UI, irrespective of any database insertions or updates (in other words, without interrupting the program flow) <noinclude>via the [[Java API]]</noinclude>  
:* In a JSP page, this function does nothing. Use a JavaScript <tt>alert()</tt>, instead.


:{| border="1" cellpadding="5" cellspacing="0"
:{| border="1" cellpadding="5" cellspacing="0"
Line 15: Line 19:
|args||string||Optional
|args||string||Optional
Declares an array of Strings in Java (or Arguments)  
Declares an array of Strings in Java (or Arguments)  
*If arguments are passed, the call expects a token
*If no additional arguments are passed, the message-string is displayed
*If no arguments are passed, the message alone is displayed
*If arguments are passed, the call expects a token. The platform then translates the token and displays the [[Custom Label]] in the selected language.
|}
|}


Line 32: Line 36:
:*Returns the localized message configured on the key in the [[Translation Workbench]]
:*Returns the localized message configured on the key in the [[Translation Workbench]]
:*If no key is configured in the translation workbench, then the passed key is returned
:*If no key is configured in the translation workbench, then the passed key is returned
<noinclude>


<noinclude>[[Category:Utility]]</noinclude>
[[Category:Utility]]
</noinclude>

Revision as of 01:20, 14 March 2014

Description

This function displays a message to the user, either at the top of page or in a dialog, depending on the context.

Considerations
  • The basic version of the function displays a message string.
  • With additional options, a localized version of a message can displayed.
  • The function displays the message in the UI, irrespective of any database insertions or updates (in other words, without interrupting the program flow) via the Java API
  • In a JSP page, this function does nothing. Use a JavaScript alert(), instead.
Element Display Type Description
key string

A category name, followed by '.' and a message or label identifier (a "token").
Example: #categoryname.tokenname

args string Optional

Declares an array of Strings in Java (or Arguments)

  • If no additional arguments are passed, the message-string is displayed
  • If arguments are passed, the call expects a token. The platform then translates the token and displays the Custom Label in the selected language.
Syntax
<syntaxhighlight lang="java" enclose="div">

void Functions.showMessage(String key [, String[] args]); </syntaxhighlight>

If no arguments are needed (for example, for a label in the #custom category), use:

<syntaxhighlight lang="java" enclose="div">

Functions.showMessage("#custom.label",null) </syntaxhighlight>

Return
  • Returns the localized message configured on the key in the Translation Workbench
  • If no key is configured in the translation workbench, then the passed key is returned