function CTRL5_5::OnClick(eventObj)
{
// Write your code here
var objNode = XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2");
var objInsertNode = objNode.cloneNode(true);
var objCurUserNode = XDocument.DOM.selectSingleNode("/my:myFields/my:field4");
objInsertNode.selectSingleNode("/my:field3").text = objCurUserNode.text;
// Insert new element
XDocument.DOM.selectSingleNode("/my:myFields/my:group1").appendChild(objInsertNode);
}
//=======
// The following function handler is created by Microsoft Office InfoPath.
// Do not modify the name of the function, or the name and number of arguments.
// This function is associated with the following field or group (XPath): /my:myFields/my:group1/my:group2/my:field2
// Note: Information in this comment is not updated after the function handler is created.
//=======
function XDocument::OnLoad(eventObj)
{
// Get current user.
var objCurUserNode = XDocument.DOM.selectSingleNode("/my:myFields/my:field4");
var objNetwork = new ActiveXObject("WScript.network");
objCurUserNode.text = objNetwork.UserDomain + "\\" + objNetwork.UserName;
var objNode = XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2/my:field3");
if(objNode.text == "")
{
objNode.text = objCurUserNode.text;
}
}
利用重复表,还需要结合InfoPath自己本身的选项定义显示条件,就可以了。
{
// Write your code here
var objNode = XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2");
var objInsertNode = objNode.cloneNode(true);
var objCurUserNode = XDocument.DOM.selectSingleNode("/my:myFields/my:field4");
objInsertNode.selectSingleNode("/my:field3").text = objCurUserNode.text;
// Insert new element
XDocument.DOM.selectSingleNode("/my:myFields/my:group1").appendChild(objInsertNode);
}
//=======
// The following function handler is created by Microsoft Office InfoPath.
// Do not modify the name of the function, or the name and number of arguments.
// This function is associated with the following field or group (XPath): /my:myFields/my:group1/my:group2/my:field2
// Note: Information in this comment is not updated after the function handler is created.
//=======
function XDocument::OnLoad(eventObj)
{
// Get current user.
var objCurUserNode = XDocument.DOM.selectSingleNode("/my:myFields/my:field4");
var objNetwork = new ActiveXObject("WScript.network");
objCurUserNode.text = objNetwork.UserDomain + "\\" + objNetwork.UserName;
var objNode = XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2/my:field3");
if(objNode.text == "")
{
objNode.text = objCurUserNode.text;
}
}
利用重复表,还需要结合InfoPath自己本身的选项定义显示条件,就可以了。
浙公网安备 33010602011771号