Applies to:
- Microsoft Office InfoPath 2003 Service Pack 1
The Office InfoPath 2003 Software Development Kit includes a code library that contains functions that may be useful to you when designing forms. These functions perform tasks that are difficult or impossible to accomplish using the Microsoft Office InfoPath 2003 object model. The functions are used extensively by the sample forms installed with InfoPath.
The name of the Microsoft JScript source file is Common.js. Note that these functions will work only with the default language of JScript and not with Microsoft VBScript or managed code. The Common.js code library file can be found in the
To use the functions, you must copy them into your form's Script.js file. Many of the functions depend on one or more of the other functions included in Common.js. For example, the count function calls the getNodeList function. You must copy both functions into Script.js if you want to use the count function.
The following table describes the functions contained in Common.js.
Function | Function Description | Parameters | ||||||
---|---|---|---|---|---|---|---|---|
convertXMLNumberToJScript | Converts the boundary conditions INF and -INF to values that are compatible with JScript. Dependencies: parseFloat |
| ||||||
convertJScriptNumberToXML | Converts the boundary conditions Number.NEGATIVE_INFINITY and Number.POSITIVE_INFINITY to XML-compatible values. |
| ||||||
getNodeValue | Returns the value contained in the specified node as a string. Dependencies: getNode, isInvalidOrEmpty |
| ||||||
getNodeTypedValue | Returns the value contained in the specified node. Use this function instead of the getNodeValue function when you want to return the value based on the data type declared in the schema. Dependencies: getNode, isInvalidOrEmpty, convertXMLNumberToJScript |
| ||||||
setNodeValue | Assigns a value to the specified node. |
| ||||||
setNodeTypedValue | Assigns a value to the specified XML DOM node. Use this function instead of the setNodeValue function when assigning a floating point or decimal value. Dependencies: getNode, convertJScriptNumberToXML |
| ||||||
setNil | Removes the value of the specified node and sets its xsi:nil attribute to "True". |
| ||||||
setRoundedValue | Rounds a number to three decimal places and assigns it to the specified node. Dependencies: getNode, roundFloat, setNodeTypedValue |
| ||||||
roundFloat | Returns a number rounded to a specified number of decimal places. |
| ||||||
normalizeSource | Ensures that the correct context of a node is returned by ignoring text nodes. Returns a node of type NODE_ELEMENT or NODE_ATTRIBUTE. |
| ||||||
normalizeParent | Ensures that the correct context of a parent node is returned by ignoring text nodes. Returns a node of type NODE_ELEMENT or NODE_ATTRIBUTE. |
| ||||||
initializeNodeValue | Assigns a value to the specified node only if the node is empty. Dependencies: getNode, setNodeValue |
| ||||||
count | Returns the number of times that the specified node appears in the form. Dependencies: getNodeList |
| ||||||
sum | Returns the sum of the nodes that match the specified XPath expression. You can use this function to create running totals. Dependencies: applyAction |
| ||||||
sort | Sorts the specified nodes in the form. |
|
The following functions are not designed to be called directly; they support the functions listed in the table above.
- applyAction
- getNode
- getNodeList
- isInvalidOrEmpty
No comments:
Post a Comment