General Utility Functions

This file gives you access to the Mobile Workflow general utility functions.

All of general utility functions are synchronous.

Method Description
guid() Generates a unique string.
S4() This function is for use in generating a GUID.
trimSpaces(str) Removes spaces from the specified string.

str – the specified string.

convertToValidJavaScriptName(str) Converts the specified string to one that is a valid JavaScript function name.

str – the specified string.

escapeValue(str) Replaces all instances in the specified string:
  • Of the & character with '&'.
  • Of the < character with '&lt;'.
  • Of the > character with '&gt;'.
  • Of the " (quotation mark) character with '&quot;'.
  • Of the ' (apostrophe) character with '&apos;'.

str – the specified string.

unescapeValue(str) Replaces all instances in the specified string:
  • Of the '&amp;' substring with ‘&’.
  • Of the '&lt;’ substring with '<’.
  • Of the ‘&gt;’ substring with ‘>’.
  • Of the ‘&quot;’ substring with '"'.
  • Of the ‘&apos;’ substring with '''.

str – the specified string.

isIOS() Returns true if the Mobile Workflow application is running on an iOS platform.
isBlackBerry() Returns true if the Mobile Workflow application is running on a BlackBerry platform.
isBlackBerry5() Returns true if the Mobile Workflow application is running on the BlackBerry 5 platform.
isBlackBerry5WithTouchScreen() Returns true if the Mobile Workflow application is running on the BlackBerry 5 platform with touchscreen capabilities.
isBlackBerry6NonTouchScreen() Returns true if the Mobile Workflow application is running on a BlackBerry 6 platform without touchscreen capabilities.
isWindowsMobile() Returns true if the Mobile Workflow application is running on a Windows Mobile Professional platform.
isWindows() Returns true if the Mobile Workflow application is running on a Windows platform.
isAndroid() Returns true if the Mobile Workflow application is running on the Android platform.
isAndroid3() Returns true if the Mobile Workflow application is running on the Android 3.0 platform.
isLocaleDatetimeFormat(htmlElement) Returns true if the specified HTML element has an attribute indicating that it should use a locale-specific display.
  • htmlElement – the specified HTML element.
  • attributeName – the attribute name.
getAttribute(htmlElement, attributeName) Reliably returns the specified attribute value for the specified HTML element.
  • htmlElement – the specified HTML element.
  • attributeName – the attribute name.
getElementsByTagName(htmlElement, tagName) Reliably returns the list of elements with the specified tag name, searching only the subtree underneath the specified element.
  • htmlElement – the specified HTML element.
  • tagName – the specified tag name.
isSomeFormOfParent(htmlElement, htmlElementToTest) Determines whether the second specified HTML element is an ancestor of the first specified HTML element.
  • htmlElement – the specified HTML element.
  • htmlElementToTest – the HTML element to test.
getFormElementById(formElement, elementID) Returns the form element with the specified ID.
  • formElement – the form element.
  • elementId – the specified ID.
getXMLHTTPRequest() Reliably returns an XMLHttpRequest object.
Note: This method is supported only on BlackBerry and Windows Mobile platforms.
getURLParam(paramName) Returns the specified parameter value from the current URL (window.location.href).

paramName – the specified parameter name.