I have a drop-down list in a table row with multiple instances that performs a calculation on the exit event. This calculation draws information from 2 other dropdown lists contained above in non-repeating rows of the same table.
The desired behavior is: should the user change their choices above, all instances of the drop-down list below would perform the ''Exit'' event script聽 accessing the new values above.
My script is:
RowOptionalCoverage.DdlCoverageType.execEvent(''exit'');聽聽聽聽 this works, sort of
It only updates the first instance of RowOptionalCoverage and none of the subsequent instances. The user can ''Tab'' through the instances and trigger the Exit event for each instance, but this is not a reasonable solution.
I have tried using the resolveNodes method without success. I understand, using the resolveNodes method may be necessary when referencing multiple instances of an object:
this.resolveNodes(''RowOptionalCoverage[*].DdlCoverageType[*]'').execEvent(''exit'') ;聽聽聽聽 doesn't work
xfa.resolveNodes(''RowOptionalCoverage[*].DdlCoverageType[*]'').execEvent(''exit''); 聽聽聽聽聽 doesn't work
No doubt, I must be using the resolveNodes incorrectly or missing something? Probably something simple.
Any advice is greatly appreciated.
Stephen
Triggering ''exit'' event of a drop-down...Hi Stephen,
You need to loop through each instance of the row and force the exit event. Without the form, it would look something like:
var oRows = xfa.resolveNodes(''RowOptionalCoverage[*]'');
var oNodes = oRows.length;
聽聽聽聽
聽聽聽 for (var i = 0; i %26lt; oNodes; i++)
聽聽聽 {
聽聽聽聽聽聽聽 xfa.resolveNode(''RowOptionalCoverage['' + i + '']'').DdlCoverageType.execEvent(''exit'');
聽聽聽 }
You could also table index to determine the number of repeating row:
var oNodes = RowOptionalCoverage.instanceManager.count;
You will probably need to edit this to get it working.
Good luck,
Niall
Triggering ''exit'' event of a drop-down...PERFECT!!! Works right out of the box!
This has opened my eyes to the essential nature of loops. My form is very large and complex and functions correctly, Yet the coding is lacking in sophistication--no loops, functions, fragments or other code efficiencies. I am teaching myself (with the help here) and I have skipped learning and using some techniques when I could things to work using the聽 limited skill set I have.
Sometimes, I just don't ''get it''. After I fail a few times, I skip it and try something else. Functions are a great example. I could utilize a bunch of these if I could only write one that works. It is frustrating. If I got one to work, I know could write a ton of them. But, there is some essential part of functions I am missing that's preventing me from having my first success with them. (I think it has to do with not understanding arguments completely).
Anyway, I am overjoyed with the solution you provided and I understand it well enough to be able to use again in other situations.
Thanks again!
Stephen
No comments:
Post a Comment