show/hide /print element on multiple master pages

Avatar

Avatar

SunsV

Avatar

SunsV

SunsV

18-10-2013

Hi again,

I'm continuing to have a problem with something that should be simple but I can't figure out.

I have a large form.

On one of the pages there's a button that says 'is there a non disclosure order in place' - radio button with yes/no.

If the user selects 'yes' I want the words 'non disclosure' to appear on all my pages.

I've gone about this by creating a text field (non editable) on each master page. It's down at the bottom middle and doesn't interfer with any other element. I've called each of these fields 'nonDis'

Radzmar and Josh Geurian have been brilliant in helping me but I'm still not quite getting it.

Back to the page that the radio buttons are on...

On the click scripting event I have this code:

var mp = xfa.resolveNodes("#pageSet.CoreMaster[*].nonDis");

var mp2 = xfa.resolveNodes("#pageSet.COREMASTER2[*].nonDis");

var mp3 = xfa.resolveNodes("#pageSet.INFORMATIONSHARING[*].nonDis");

var mp4 = xfa.resolveNodes("#pageSet.CHRONOLOGY[*].nonDis");

var mp5 = xfa.resolveNodes("#pageSet.NATPRACTICEMODEL[*].nonDis");

var mp6 = xfa.resolveNodes("#pageSet.ASSESSMENT[*].nonDis");

var mp7 = xfa.resolveNodes("#pageSet.PLAN[*].nonDis");

var mp8 = xfa.resolveNodes("#pageSet.REVIEW[*].nonDis");

var mp9 = xfa.resolveNodes("#pageSet.PLAN2[*].nonDis");

var mp10 = xfa.resolveNodes("#pageSet.SUMMARYESSENTIALINFO[*].nonDis");

var mp11 = xfa.resolveNodes("#pageSet.OPEN[*].nonDis");

for (var i = 0; i < mp10.length; i += 1) {

     mp10.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp11.length; i += 1) {

     mp11.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp.length; i += 1) {

     mp.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp2.length; i += 1) {

     mp2.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp3.length; i += 1) {

     mp3.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp4.length; i += 1) {

     mp4.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp5.length; i += 1) {

     mp5.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp6.length; i += 1) {

     mp6.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp7.length; i += 1) {

     mp7.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp8.length; i += 1) {

     mp8.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

for (var i = 0; i < mp9.length; i += 1) {

     mp9.item(i).presence = this.rawValue != "No" ? "visible" : "hidden";

}

I've referenced each of the nonDis text fields individually but only the fileds in the master pages: CoreMaster, COREMASTER2, SUMMARYESSENTIALINFO and OPEN work. Despite their ordering in the code they happen to be the first four master pages that are used in order in the document. The actual order is: OPEN, SUMMARYESSENTIALINFO, CoreMaster, COREMASTER2 - these are then followed by INFORMATIONSHARING and contine down the list in order.

I should mention that each nonDis field appears on the top level of each of the master pages (ie. not in a sub form). I have a feeling it's something perhaps to do with my above code maybe not being succint enough - or there being a better way to write it. It could also perhaps be something to do with the transition between the last page that does work (using COREMASTER2 masterpage) to the first one that doesn't (using INFORMATIONSHARING master page).

There is also another big issue in that as soon as I click the print button all the nonDis fields revert back to their opening state of invisible and they stay that way despite the radio button remaining selected on 'Yes' - if i toggle yes/no they reappear on screen, but again disappear when printing. I can't let this happen as the form is meant to be printed.

screenshothelp.jpg

So please help... this is (I think) the last piece of the puzzle in a project that has taken months. If there's anything else I can provide you with to help please just ask.

View Entire Topic

Avatar

Avatar

SunsV

Avatar

SunsV

SunsV

21-10-2013

Hi Radzmar,

Almost there... I think!

It worked up to a point. As soon as I click/toggle yes/no the nonDis field does indeed appear on each and every page. However as soon as I send to print they all disappear.

Doing a few tests it's because of several causes (I think). I have a number of tables which can grow when the user adds info (in fact most text fields have this ability). Also, I have text fields full of information for the user which I have scripted to disappear when sending to print (so the printed form contains user data rather than pages of background info). Finally I have a whole section whose content alters radically depending on which department the user belongs to.

I've noticed that as soon as a page expands to effectively create another page the nonDis field disappears again (the radio button remains selected as 'Yes') - so my gut feeling is that the code above works only if the page count remains the same. Doing more tests I can see that as soon as even one text field adds another page to the form the nonDis disappears again.

Finally, I've also done a test on my clean form - with only the radio button, the nonDis field (on a master page) and a text field and if I set this box to flowed and expand the height as soon as the field goes beyond the page to create another page the nonDis disappears once again even though the button remains as 'yes'

Sunil