Using PODS functions from JavaScript engine

PODS functions can greatly extend the capabilities available in JavaScript engine alone. For example, you cannot use JavaScript engine to dynamically generate an HTML page in M-Business Client; the document.write() method, which performs this function in standard JavaScript, is not implemented. However, you can use the PODS ADOMObject from JavaScript engine to achieve the same result. See ADOMDOMImplementation object.

PODS functions are accessed from JavaScript engine in two different ways, depending on the type of PODS function being accessed:

  • Standard PODS objects that PODS automatically exposes to JavaScript are accessed by simply prefixing the PODS attribute or method name with the corresponding JavaScript object name. See M-Business JavaScript engine proprietary JavaScript objects. It is not necessary to look up this prefix every time you want to use a standard PODS function; for all attributes and methods that are exposed to JavaScript, the JavaScript object name is included in the JavaScript synopsis for the attribute or method in the reference material in the API Reference for M-Business Anywhere—beginning with the chapter, PODS API Mechanics.

  • Custom PODS objects require you to create a JavaScript object corresponding to your custom PODS object, using the JavaScript avantgo.createObject() method. You then can access your POD's functions by simply prefixing the attribute or method name with the name of the JavaScript object you created for your POD. The following section explains the use of avantgo.createObject() to access custom PODS objects.

    Note

    There are several things you must do in your custom POD's code, before it can be accessed from JavaScript. See Exporting a PODS Object to M-Business JavaScript Engine. The instructions in the rest of this section assume that you have completed these tasks.


Using CreateObject( ) to expose a POD to JavaScript engine
How M-Business Client uses getMethod( )