1.Debugging Calculations and Scripts(messagebox)
用途:调试Javascript时,可以使用messagebox(消息框)提供的反馈信息。缺点之一是user必须关闭很多消息框。
Example:
FormCalc
xfa.host.messageBox(Concat("The value of NumericField1 is: ", NumericField1), "Debugging", 3)
JavaScript
xfa.host.messageBox("The value of NumericField1 is: " + NumericField1.rawValue, "Debugging", 3);
var result = xfa.host.messageBox($record.language.errorMessage.ErrorMsg_SaveEvent.value,"Confirmation",2,2);
2.获取当前日期
Example:
var currentDate = new Date();
app.alert(currentDate);
Result:
var currentDate = new Date();
var year = currentDate.getFullYear();
var month = currentDate.getMonth() + 1;
var day = currentDate.getDate();
var hour = currentDate.getHours();
var minute = currentDate.getMinutes();
3.app.execMenuItem();
Acrobat JavaScript Works in LiveCycle Designer LiveCycle Designer equivalent LiveCycle Designer JavaScript Description
app.execMenuItem() Y N — Executes the specified menu item. Can be
used in LiveCycle Designer for menu
items such as Close, Find, Save, Save As,
Open, Print, etc.
4.saveXML
Saves the XML structure of the current node class to a string.
Syntax:
Reference_Syntax.saveXML( [ "pretty" ] )
Parameters: pretty
(Optional) Outputs the XML string in an easier to read format.
Returns:A valid string representing the XML fragment of the current object.
Applies to: node class class
Version: XFA 2.1
Examples:
JavaScript FormCalc
xfa.data.saveXML(); xfa.data.saveXML()
xfa.data.saveXML("pretty"); xfa.data.saveXML("pretty")