Apologies for being a tad lazy.... after finally getting my head around the basics of dynamic forms, and succesfully creating the form I wanted, I'm a little stuck on some javascript, and my text-based (mathematically hopeless) brain will probably take months to comprehend the code required for the final piece of the puzzle.
In its freshly opened state, my form has all the user-entry fields on page one, and a text field object on page 2 containing completion guidelines.
As the form may expand to 2 or occasionally even 3 pages on completion, the guidelines object (which almost fills a page and doesn't allow breaks) will move to page 3 or 4.
The guideline object is set to visible-(screen only).
I've added a subform with two print fields above the guideline text object. One is the standard print button that prints the whole document, and, as expected, the guidelines do not print. The other was intended to print the form and guidelines, but it doesn't render the guidelines visible.
So... the first question is, can someone tell me why this script doesn't work? (no action at all, but no syntax error)
//+ GENERATED - DO NOT EDIT (ID:E8C4C0CE-1372-4CCB-96F3-AA8469CAF35F CRC:1860632424)
//+ Type: Action
//+ Result1: SetPresence("$Node2","visible")
//+ Node2: form1[0].Text6[0]
//+ Node1: form1[0].#subform[23].PrintButton2[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: PrintButton2.click
this.resolveNode("Text6").presence
xfa.host.print(1
, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0,
0);
Better still: is there a (not inordinately complex) way of printing a specific object only (in this case, the guidelines text field)?
Many thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
As your form is already Dynamic (flowed), then for your second print button, you could hide the main pages in the click event, print the remaining pages and then lastly show all pages.
If you are looking for the syntax to change the presence and relevant properties of an object (Text6) look here: http://assure.ly/h7whb8.
For example this will allow the object to be visible and print:
Text6.presence = "visible";
Text6.relevant = "+print";
To change it back to Visible (Screen Only):
Text6.presence = "visible";
Text6.relevant = "-print";
Hope that helps,
Niall
Views
Replies
Total Likes
Hi,
As your form is already Dynamic (flowed), then for your second print button, you could hide the main pages in the click event, print the remaining pages and then lastly show all pages.
If you are looking for the syntax to change the presence and relevant properties of an object (Text6) look here: http://assure.ly/h7whb8.
For example this will allow the object to be visible and print:
Text6.presence = "visible";
Text6.relevant = "+print";
To change it back to Visible (Screen Only):
Text6.presence = "visible";
Text6.relevant = "-print";
Hope that helps,
Niall
Views
Replies
Total Likes
Many thanks Niall;
Good of you to share your expertise when you have a business to run.
Adding the 2nd parameter did the job as you would expect. I added the 'back to visible' (Screen Only) code to the postPrint event... that works, but is that the correct (neatest) way to achieve the result?
To achieve the alternative of printing the Guidelines only (Text6) you suggest hiding the main pages in the click event. Forgive the numptie question....does this have to be done by individually hiding each subform and table on those pages? (given that the number of pages can be 1 or 2).
Your linked form info will be useful too.
Thanks again,
Steve
Views
Replies
Total Likes
Hi Steve,
You're welcome.
Yes, when setting things like Visible (Screen Only), you do have to change the presence and the relevant properties.
If you want to hide all of the contents, then yes hiding a whole page is possible. Depending on your form structure and pagination, you may need to do a loop.
Hope that helps,
Niall
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies