M
Marc
I’m trying to do something as easy as to add the content of two boxes called
Total (which is the result of another addition) and Transport (which the user
enters manually) in a third one called TotalAddition. I don’t want to use an
expression box because my aim is to start understanding basic Script.
The Script I’ve entered is:
/*------------------------------------------------------------------------------ CalcAddTotalAmount Adds perdiems and transport
------------------------------------------------------------------------------*/
function AddTotalAmount(itemNode)
{
var nTotalAddition = itemNode.selectSingleNode("my:TotalAddition");
var nPerdiems = itemNode.selectSingleNode("my:Total");
var nTransport = temNode.selectSingleNode("my:Transport").nodeTypedValue;
if (isNaN(nPerdiems))
nPerdiems = 0;
if (isNaN(nTrasnport))
nTransport = 0;
nTotalAddition.nodeTypedValue = (nPerDiems + nTransport);
}
THEN THE FOLLOWING HANDLER
function msoxd_my_Transport::OnAfterChange(eventObj)
{
if (eventObj.IsUndoRedo) return;
AddTotalAmount();
}
The message I get when I enter data in Transport is ‘Item Node is null or
not an object’. Could anyone correct my basic Script?
Thank you,
Marc
Total (which is the result of another addition) and Transport (which the user
enters manually) in a third one called TotalAddition. I don’t want to use an
expression box because my aim is to start understanding basic Script.
The Script I’ve entered is:
/*------------------------------------------------------------------------------ CalcAddTotalAmount Adds perdiems and transport
------------------------------------------------------------------------------*/
function AddTotalAmount(itemNode)
{
var nTotalAddition = itemNode.selectSingleNode("my:TotalAddition");
var nPerdiems = itemNode.selectSingleNode("my:Total");
var nTransport = temNode.selectSingleNode("my:Transport").nodeTypedValue;
if (isNaN(nPerdiems))
nPerdiems = 0;
if (isNaN(nTrasnport))
nTransport = 0;
nTotalAddition.nodeTypedValue = (nPerDiems + nTransport);
}
THEN THE FOLLOWING HANDLER
function msoxd_my_Transport::OnAfterChange(eventObj)
{
if (eventObj.IsUndoRedo) return;
AddTotalAmount();
}
The message I get when I enter data in Transport is ‘Item Node is null or
not an object’. Could anyone correct my basic Script?
Thank you,
Marc