Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Determine Which Node an Event has Occurred?

Avatar

Avatar
Level 1
vinnie_cartabia
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
vinnie_cartabia
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
vinnie_cartabia
Level 1

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!

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jasotastic81
Level 4

07-07-2015

If you can provide a screenshot of the hierarchy, I may be able to make this advice more specific.

Are you changing something in the same instance where the change event occurs? If so, using .parent to walk up the hierarchy may a useful option for you. If you have a subform that repeats and two nodes inside called tfSomething and tfSomethingElse, and you want to have the exit event for tfSomething affect the other, then this.parent.tfSomethingElse will always hit the tfSomethingElse in the same subform.

Are you changing something in another subform/container that is indexed the same as the place your event occurs? Then you could use this.parent.index to get the index of the subform/container that holds the node with the event.

One of these two methods keeps you from having to worry about exactly which node is generating the event in almost all cases. Again, if this doesn't help, a screenshot can help us give you a better idea of what to do.

Avatar

Avatar
Level 1
vinnie_cartabia
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
vinnie_cartabia
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
vinnie_cartabia
Level 1

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";

}

}