Javascript API

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



The Workflow Javascript API is a Javascript library that allows you to manipulate your workflow forms "on the client side" (that is in the user's browser). This allows you to:

  • access items of the form and manipulate them (for example show/hide/remove)
  • serialize and submit the entire form or parts of it to the server
  • embed dynamic, user-driven form actions in your workflow

Typical use cases for this API include:

  • you want the workflow form to respond to user actions (for example hide the "Post Address" form group if the user clicked the "Notification: Email" checkbox)
  • you want to write custom form field rules, that validate user input on the fly (e.g. an advanced password validator that ensures the entered password consists of more than two uppercase letters)


Getting Started

You want to try before you start developing on our API to set up a suitable Javascript Development environment. We recommend the following tools:

  • recent versions of all major browsers (IE, Firefox - don't forget to install the Firebug development extension, Chrome)
  • An editor/IDE with Javascript syntax highlighting capabilities (e.g. Visual Studio, Notepad++)
  • If you need to target older versions of Internet Explorer, we recommend the installation of one of the testing VMs provided by Microsoft.
  • If you encounter a bug/error, please follow the instructions on the page Report Errors (How To).

Changes in GMSC 2014

  • Form conditions are now propagated downwards the form and merged before evaluation. This means that not only the condition on the form item itself influences its visible/editable state, but also conditions applied to parent items. Propagated Form Conditions allow advanced, real-time manipulations of Workflow forms that are directly triggered by user input.
  • smartclient:ready event for registering custom scripts in the GMSC browser. This event is triggered when both Smart Client and the shown workflow form are ready for script manipulation and is the logical starting point for scripts that combine form and Smart Client manipulations.
  • asynchronous form rendering for improved startup performance
  • Relative Date validators check if the entered date is before, after or on the current date. This addresses common validation needs (e.g. "The delivery date has to lie in the future, not the past").
  • The betweenDate validator checks if the value of a date field lies between the values of two other date fields. It can be used to restrict the input of a date field to a date period given by the user (e.g. the inspection date of a construction work has to lie within the user-supplied working term).
  • Custom validation messages can now be localized in order to support multi-language environments.
  • Documentation improvements:
    • The Javascript API Cookbook has been greatly enhanced and contains dozens of ready-to-go recipes for common scripting tasks.
    • The brand-new API CheatSheet provides a printable, one-page reference of the entire Workflow Javascript API.
    • Version badges denote in which Smart Client version a certain API functionality has been introduced or modified: GMSC 07 GMSC 2013 GMSC 2014

Changes in GMSC 2013

  • improved FormModel API that accurately reflects the state of your form
  • introduction of global IG.vent registry for easier event handling
  • easy communication with remote Workflow Controllers using the IG.Url helper object
  • various performance improvements