D
Deken
In Infopath 2003, in JScript, is it possible to determine an attribute's
parent element? I need to be able to update the value of a sibling attribute
when the first attribute is changed, and I can find no way to climb the tree
from the attribute to its containing element.
I would think that this would work:
/**********************************************/
function OnAfterChange(eventObj)
{
var curNode = eventObj.Source;
var found = false;
while (! found) {
if (curNode.nodeTypeString == "element"){
var modflag = curNode.getAttribute("modflag");
if (modflag != null) { // null is missing
if( modflag != "true" ) {
curNode.setAttribute("modflag","true");
}
found = true;
}
}
curNode = curNode.parentNode;
if (curNode == null) {
found = true; // pseudo found - reached top
}
}
return;
}
/**********************************************/
except that when curNode.nodeTypeString == "attribute", curNode.parentNode
is null.
TIA for any assistance available!
Deken
parent element? I need to be able to update the value of a sibling attribute
when the first attribute is changed, and I can find no way to climb the tree
from the attribute to its containing element.
I would think that this would work:
/**********************************************/
function OnAfterChange(eventObj)
{
var curNode = eventObj.Source;
var found = false;
while (! found) {
if (curNode.nodeTypeString == "element"){
var modflag = curNode.getAttribute("modflag");
if (modflag != null) { // null is missing
if( modflag != "true" ) {
curNode.setAttribute("modflag","true");
}
found = true;
}
}
curNode = curNode.parentNode;
if (curNode == null) {
found = true; // pseudo found - reached top
}
}
return;
}
/**********************************************/
except that when curNode.nodeTypeString == "attribute", curNode.parentNode
is null.
TIA for any assistance available!
Deken