JavaScript CookBook/Custom Scripts/Opening dialogs to show error messages or confirm a choice

From GeoMedia Smart Client
Jump to: navigation, search
GMSC 2013/2014 Javascript API Overview Form Events Types Utility Functions client-side Validation Conditions Interaction with SmartClient Cookbook Cheatsheet


Opening dialogs to show error messages or confirm a choice

Problem: During the execution of your custom script you want to prompt the user with error messages or let him/her confirm a critical choice (e.g. "Do you want to delete this item?")

Solution: For very simple cases, you can use the dialog ressources provided by the browser:

  • window.alert: opens a modal dialog with the given message and an "OK" button to close it.
  • window.confirm: opens confirmation dialog with the given message and an "OK" and "Cancel" button.
  • window.prompt: opens a prompt dialog in which the user can enter values.

However, these simple solutions come with a few downsides: you can't style your message with HTML, furthermore all of these dialog block the execution of other Javascripts while they are open. This means e.g. the processing of AJAX requests in the background is frozen.

Therefore, the Workflow Javascript API provides a few dialogs that come without these problems GMSC 2014:

  • IG.Confirm: a non-blocking confirmation dialog
  • IG.notify: "sticky" status notifications
  • IG.Busy: an alert-like, non-blocking message dialog that was specifically designed to be shown during pending AJAX requests.



Other Recipes in this category: