Knowledge Base
  • Introduction
  • Events and Actions
  • Action Panel
  • sending email
  • calling a SQL action from a client side js action
  • Accessing to translations form a server
  • Executing SQL statements from within an action
  • How to invoke a generic SQL statement defined through a SQL action
  • How to show a message dialog
  • checking for "undefined" values
  • How to add spaces to the right of a text
  • How to create a docx report and show it on the web browser Enterprise Edition only
  • How to get or set a value from the graphics control
  • How to invoke a generic SQL query defined through a business component
  • How to remove spaces to the left and right of a text
  • How to support multiple themes in a single application, accoding to a rule
  • How to set content to a Google Map linked to a grid or form
  • How to replace all occurences of a pattern from a text
  • Utility methods
  • Link auto login
  • Creation of a link for the first access of a new user without give the user a password and forcing
  • Forgot password
  • setting up default values from values coming from a filter panel
  • identifing the modified record after the alteration
  • enabling/disabling checkboxes in a grid
  • Filtering a Lookup
  • formatting a column
  • using checkboxes to select rows in grid
  • showing a summary row in grid
  • Disabling a toolbar button
  • Configuring grid exports
  • Adding filter conditions to a grid
  • Filtering the grid content from a tree
  • Filtering the tree content, starting from a filter panel linked to a grid
  • collapsing a panel
  • validating a lookup
  • accessing the authorizations set for a specific grid
  • How to design a web service
  • How to remotelly invoke an action or business component or perform a write operation through a Restf
  • how to feed a grid from a JS business component
  • converting a JS object to a JSON string
  • executing a query
  • passing parameters to a server side JS action
  • return value
  • scheduling and frequency
  • finding the right filter panel
  • checking out if a component has been defined
  • Deploying an application
  • Enquiring a table belonging to the Platform repository
  • Adding a where clause to a business component linked to grid
  • Integrating Mailchimp lists
  • Formatting a number as a currency value to use it inside an email template
  • sending email from a template
  • How to send an email
  • Error 'smtpHost' is empty
  • Linking two windows
  • How to open manually a window from another window
  • How to open manually a popup window
  • How to hide a panel in a window dinamically
  • How to manage folder panels
  • How to manage card panels
  • Predefined variables supported by Platform
  • Accessing the application parameters
  • Application Log
  • How to design a web service
  • How to import java classes in server
  • How to import java classes in server
  • How to dynamically set a value on a combo
  • 4WS.Platform
  • How to listen to events in a mobile HTML panel
  • Issues with HTTPS requests
  • How to manage row totals in grid
  • How to send to the UI a notification to execute code automatically
  • How to filter a chart by date interval
  • How to filter a grid by date interval
  • How to read a text or csv file and save data on the database
  • How to write text or csv files
  • Reading an xls file stored in the specified path
  • How to create a report with Jasper Report
  • How to customize the alert message content
  • Setting up a cluster
  • Uploading and downloading files
  • How to listen to user definition changes
  • How to auto-show a window from login
  • How to manage encrypted fields
  • How to change CSS settings for a grid row
  • Customizing a Tree Panel
  • How to execute complex queries on Google Datastore
  • Theme customization
  • Retrieve and send the log of a mobile app
  • Import Roles and Users
  • How to synchronize multiple Form panels in the same window
  • Anchor buttons
  • Properties of subpanels
  • Bulk import
  • How to display the data not found message in a grid
  • How to setup an LDAP based authentication
  • How to synchronize data from Datastore to BigQuery
  • How to synchronize data from Datastore to Google Spanner
  • How to synchronize data from Datastore to CloudSQL
  • Scrollable form list
  • How to setup SAML authentication
  • How to export data from BigQuery in streaming
  • Update Google Spreadsheet
  • How to setup OAuth2 authentication
Powered by GitBook
On this page
  • Example
  • Example
  • Example

Was this helpful?

How to show a message dialog

Javacript language provides the function alert() to show a message dialog: this function should never be used, since it does not inherit the theme used for the whole application.

4WS.Platform provides 3 message dialogs, having the following signature:

  • showMessageDialog(title, message, okFunc, modal, closable, opts)

  • showConfirmDialog(title, message, yesFunc, noFun, opts)

  • showInputDialog(title, message, okFunc, modal) deprecated

  • showInputDialog3(title, message, okFunc, modal, cancelFun, inputValue, width, height, closable)

  • showListDialog(title, width, height, codes, descriptions, callback, multipleSelection, closable)

  • showMoreInputDialog(title, labels, attributes, okFun, modal, cancelFun, defaultAttributesValue, attrProperties)

The first function shows a message dialog with a title, a message and a "ok" button. A callback function is invoked when pressing the "ok" button; the modal boolean flag is used to make the dialog modal or not.

Example

showMessageDialog( "window1.title", "window1.message", function() {}, true, false, 
    {
        "formCls" : "cls-form-alert",
        "windowCls": "",
        "windowIconCls": "",
        "yesButtonCls": "",
        "yesButtonIcon": "",
        "cancelButtonCls": "",
        "cancelButtonIcon": "",
        "switchButton": "Y", //Y=cancel-ok; N or null=ok-cancel
        "buttonAlign": "center", //"left" or "right"
        "width": 500, //optional (300 is default): 'auto' for autodimension
        "height": 300 //optional (160 is default): 'auto' for autodimension
    }
);

The second function shows a message input dialog with a title, a message and two buttons: one used to confirm and the other to refuse the choice. A callback function is invoked when pressing the confirmation button; a second callback function is invoked when pressing the refusal button.

Example

showConfirmDialog( "window1.title", "window1.message", 
    function() {
      // do something if user has confirmed the choice
    }, 
    function() {}, 
    {
        "formCls" : "cls-form-alert",
        "windowCls": "",
        "windowIconCls": "",
        "yesButtonCls": "",
        "yesButtonIcon": "",
        "cancelButtonCls": "",
        "cancelButtonIcon": "",
        "switchButton": "Y", //Y=cancel-ok; N or null=ok-cancel
        "buttonAlign": "center" //"left" or "right"
    });

If you want more buttons you can use this

showConfirmDialogButtons("window1.title", "window1.message", 
    titleButtons[
        'button1.title',
        'button2.title'
    ], 
    funButtons[
        function() {
          // do something if user has selected the button1
        },
        function() {
          // do something if user has selected the button2
        }
    ], 
    {
        formCls: null, //'cls-form-alert' for example
        buttonAlign: null, //'center' is the default, 'right' or 'left'
        windowCls: null, //'windowCls' for example
        windowIconCls: null, //'windowIconCls' for example
        windowWidth: null, // default 300,
        windowHeight: null, // default 160,
        windowMinWidth: null, // default 300,
        windowMinHeight: null, // default 160,        
        clsButtons: [
            'button1Cls',
            'button2Cls',
        ], //optional, you can set null
      	iconButtons: [
            '/images/button1Icon.png',
            '/images/button2Icon.png'
        ] //optional, you can set null
    } //options
);

The third function shows a message dialog with a title, a message and a "ok" button. A callback function providing the inputed value is invoked when pressing the "ok" button; the modal boolean flag is used to make the dialog modal or not.

Example

showInputDialog3( "window1.title", "window1.message", function(value) {
  // do something with the inputed "value"
}, true, function(){
  //cancel callback
}, "defaultValue", 500, 300, true);

With the forth one, you can open a dialog with a list inside it, where the user can choose one (or more) entries and use a callback function to handle the selected ones.

showListDialog(
"My Dialog Title",
500, //Width
300, //Height
[1, 2, 3, 4, 5], //My codes (example: IDs)
["First Code", "Second Code", "Third Code", ...], //My descriptions
function(entry){
console.log(entry[0]); //Logs the selected CODE
},
false, //Only allow one item to be selected
false //Do not let the user close the modal without selecting an entry
)

You can directly specify title and message in your own language if your application supports one language only, otherwise, you should specify "entries" for title and message whose real translations can be defined through the "Translation" functionality: this feature allows you to add new translations, via "add" button; in this way you can create translations for each language that will be used by these message dialogs. For each message dialog, you should add two rows in the "Translations" list: one for the title and the other for the message entry. For each row, you can leave empty the first cell (Topic), fill in "Id" with the entry (title/message) and fill in all the other dynamic columns with a translation for each language.

If you want more input valued from users you can use:

showMoreInputDialog(
  "window1.title", 
  [
    "prefix.custom label one",
    "prefix.custom label two"
  ], //labels
  [
    "fieldOne",
    "fieldTwo"
  ], //attributes
  function(value) {
    // do something with the inputed "value"
  }, //okFun 
  true, //modal
  function(){
    //cancel callback
  }, //cancelFun
  [
    "",
    "field two value"
  ], //defaultAttributesValue
  , 
  [ {type: 'NUM'}, {type: 'CHECK', positiveValue: 'Y', negativeValue: 'N'}] //attrProperties
);

If you want a confirm by user you can use

PreviousHow to invoke a generic SQL statement defined through a SQL actionNextchecking for "undefined" values

Last updated 1 year ago

Was this helpful?