Hi there,
I've been struggling with a problem all day.
I have a large document using multiple master pages. I want a button on one single page to make an element on one of the master pages to toggle the visibility. This should happen on any and all pages that use that particular master page.
So... here's my code:
if (this.rawValue == "2") {
this.resolveNode("#pageSet.CoreMaster.nonDis").presence = "hidden";
}
if (this.rawValue != "2") {
this.resolveNode("#pageSet.CoreMaster.nonDis").presence = "visible";
}
I've placed this on a radio button set which has values for 1=no and 2=yes
if the user selects yes (ie value 2) it makes the text field called 'nonDis visible - if they select no - it then hides it. The element nonDis is on the master page called CoreMaster.
It works! Well almost. It only works on the very first page of the document. It's visibility on all other pages (that use that particular master page) still have the nonDis text field as hidden.
Incidentally, thinking it was my form (it's abig form) that was at fault, I tried a brand new form wioth nothing but that one element but with two pages and got the same issue - hidden on the first page, but not on the second.
I have no idea why - can someone help?
Many thanks,
Sunil
Solved! Go to Solution.
Views
Replies
Total Likes
As the master pages are repeatable object, they also have index numbers like [0], [1] etc.
Your current expression is only referencing the first instance of your master page.
To reference all instances you need a loop function.
var mp = xfa.resolveNodes("#pageSet.CoreMaster[*].nonDis");
for (var i = 0; i < mp.length; i += 1) {
mp.item(i).presence = this.rawValue != "2" ? "visible" : "hidden";
}
Views
Replies
Total Likes
As the master pages are repeatable object, they also have index numbers like [0], [1] etc.
Your current expression is only referencing the first instance of your master page.
To reference all instances you need a loop function.
var mp = xfa.resolveNodes("#pageSet.CoreMaster[*].nonDis");
for (var i = 0; i < mp.length; i += 1) {
mp.item(i).presence = this.rawValue != "2" ? "visible" : "hidden";
}
Views
Replies
Total Likes
Thank you so much radzmar,
I had a feeling that it had something to do with requiring a loop of some description, but this level of programming is beyond me.
Thanks for helping me out here - couldn't have done it without you.
Sunil
Views
Replies
Total Likes
ah, no, it didn't quite work - it's working on some master pages but not on others. As I've said this is the correct answer I'll post another question.
Views
Replies
Total Likes
Views
Likes
Replies