J
Jamie
I would like a onload function that populates the COMPUTERS name and the
USERS userid
I currenlty do this with the below function but have some issues with it.
One: When I'm in Design and click Preview Form it works (receive ActiveX
confirmation and populates data) when I double click the xsn file it does
not work (no ActiveX confirmation and does not populate data).
Two: it requires the user to say yes to an activeX message is there a way to
avoid this?
==========================================================
function XDocument::OnLoad(event)
{
// Avoid DOM updates when the document has been digitally signed.
if (XDocument.IsSigned)
return;
// Initialize the date
initializeNodeValue("/iss:issue/iss:createdDate",
getDateString()+"T"+getTimeString());
//Create a WScript.Network object, which provides access to the user
data
var objNetwork = new ActiveXObject("WScript.network");
//Retrieve the UserName and write it into the my:UserName field
XDocument.DOM.selectSingleNode("/iss:issue/my:UserName").text =
objNetwork.UserName;
//Retrieve the ComputerName and write it into the my:ComputerName field
XDocument.DOM.selectSingleNode("/iss:issue/my:ComputerName").text =
objNetwork.ComputerName;
}
USERS userid
I currenlty do this with the below function but have some issues with it.
One: When I'm in Design and click Preview Form it works (receive ActiveX
confirmation and populates data) when I double click the xsn file it does
not work (no ActiveX confirmation and does not populate data).
Two: it requires the user to say yes to an activeX message is there a way to
avoid this?
==========================================================
function XDocument::OnLoad(event)
{
// Avoid DOM updates when the document has been digitally signed.
if (XDocument.IsSigned)
return;
// Initialize the date
initializeNodeValue("/iss:issue/iss:createdDate",
getDateString()+"T"+getTimeString());
//Create a WScript.Network object, which provides access to the user
data
var objNetwork = new ActiveXObject("WScript.network");
//Retrieve the UserName and write it into the my:UserName field
XDocument.DOM.selectSingleNode("/iss:issue/my:UserName").text =
objNetwork.UserName;
//Retrieve the ComputerName and write it into the my:ComputerName field
XDocument.DOM.selectSingleNode("/iss:issue/my:ComputerName").text =
objNetwork.ComputerName;
}