Determine Which Node an Event has Occurred?

Avatar

Avatar

vinnie_cartabia

Avatar

vinnie_cartabia

vinnie_cartabia

07-07-2015

Hello Experts! I currently have a repeating subform that generates a new instance for each row in a table that I am importing. I am attempting to have some field values change based on an even that occurs in another field, and these changes need to be specific to the instance where they occurred. I will be putting my code in the CHANGE event and was wondering if there is a way to determine which node the change is occurring in. If you require further clarification/explanation please let me know, I'm at somewhat of a roadblock because of this issue and would really appreciate the help, thanks!

View Entire Topic

Avatar

Avatar

vinnie_cartabia

Avatar

vinnie_cartabia

vinnie_cartabia

07-07-2015

As a quick follow up, here's the code I am currently using which loops through each node and is supposed to make changes accordingly. If there is no way to determine which node an event is occurring on, then I don't mind going the loop route but for some reason this loop is not having the desired effect. This code is hit in the CHANGE event for nodeName1, and I'm getting strange behavior where making a change in one instance of my subform will have an effect in the other instances.

data.Page.DATA.USER_INPUT.RECV_CU_WGT::change - (JavaScript, client)

var nodeCount = data.Page.dataNode.resolveNodes("DATA[*]").length;

for(var i = 0; i < nodeCount; i++){

     var nodeName1 = "data.Page.DATA["+ i +"].USER_INPUT.RECV_CU_WGT";

     var nodeName2 = "data.Page.DATA["+ i +"].USER_INPUT.RECV_CU_WGT_UOM";

     var nodeName3 = "data.Page.DATA["+ i +"].USER_INPUT.RECV_CU_WGT_PER";

     var nodeName4 = "data.Page.DATA["+ i +"].USER_INPUT.RECV_CU_WGT_PER_UOM";

     if(xfa.resolveNode(nodeName1).rawValue == null){

          xfa.resolveNode(nodeName2).mandatory = "error";

          xfa.resolveNode(nodeName3).mandatory = "error";

          xfa.resolveNode(nodeName4).mandatory = "error";

}

if(xfa.resolveNode(nodeName1).rawValue != null){

     xfa.resolveNode(nodeName2).mandatory = "disabled";

     xfa.resolveNode(nodeName3).mandatory = "disabled";

     xfa.resolveNode(nodeName4).mandatory = "disabled";

}

}