I am trying to Show / Hide the final page of an audit report depending on what town is selected from the drop down box.
The code that I'm using is :
if
("4" == xfa.event.newText)
{
Page7.presence
= "visible";
}
Page 7 is set to "hidden" as I only want it to show / print if certain towns are selected (Bundaberg being one of them)
The drop down box has had the Values set so "4" = Bundaberg. The scripting is on a change event.
Can someone please help as this code isn't working.
Thanks.
Jenny
Solved! Go to Solution.
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi Jen,
SOM stands for Script Object Model and it relates to how you script objects.
xfa.host.setFocus(xfa.form.form1.Page2.Subform1.Text12); is an example where you are implicitly specifying the full object reference.
xfa.form is accessing the Form DOM (Document Object Models). Help file will have more info.
form1 is the root node (default and as per your screenshots above).
Page2.Subform1 are objects in your form (again as per your screenshots).
Now Text12 looks like static text and therefore is not an object that will receive focus. You would need to reference an object on Page2 that can receive focus, like a button or a textfield.
So if you replace Text12 with a named button or field it should work.
Niall
Views
Replies
Total Likes
Hi Niall,
IT WORKS
Thank you so very much.
Jen
Views
Replies
Total Likes
Hi Niall,
I have looked at the form this morning and for some reason the problem isn't working correctly.
Can you please have a look and let me know. There are two pop-up..... one of page 2 and the other on page 5.
Regards
Jen
Views
Replies
Total Likes
One of the issues was that the setFocus script was in the postPrint event of two objects, so it was trying to set focus on two objects at the same time.
Using a global variable and testing against that helped separate out the two scripts so that it works now.
Niall
Views
Replies
Total Likes
Thank you for your e-mail.
I will look closely at all your suggestions.
With using tool tips, how can I change the width of the box?
Jen
Views
Replies
Total Likes
Hi Jen,
You cannot directly set the width of the tooltip. Below is an example of where there is a long string of text as a tooltip and Acrobat/Reader automatically sets the width:
You can influence the width of the tooltip by placing a return as you are typing the tooltip in the Object > Accessibility tab. You can do this by holding Control and pressing Enter/Return. See below:
I hope this works out for you,
Niall
Views
Replies
Total Likes
Thank you for your assistance over the last couple of days. Your information has been very helpful
Jen
Views
Replies
Total Likes
You're welcome. Let me know if you need clarification or a dig out.
Niall
Views
Replies
Total Likes
Thank you for expalining clearly that a newbie can understand. Much appreciated
I have been able to
I have got the 'Hide help page' button to work but unfortunately I don't know how to program the 'Print help page' button to print current help page and return to that page.
Thanks in advance
Jenny
Views
Replies
Total Likes
Hi Jenny,
Good work, nearly there.
The print button is fairly straightforward, it is just takes a little setting up because your form can increase in page numbers. There are two possible approaches and it depends on where you put the help page(s).
If you place the hidden help pages at the end of the form then it is very easy to script, because when a help page is made visible it will always be the last page in the form, no matter how many additional rows the user has added.
So if you look at the script in a standard print button, you will see that there are eight parameters. The help file explains each of these, but the two that you are interested in are the second and third.
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);
The second parameter is "0", which instructs Acrobat/Reader to start printing from the first page, as the pages are numbered on a zero basis.
The third parameter is a little script: "(xfa.host.numPages -1).toString()" where Acrobat/Reader works out the total number of pages in the form and then subtracts 1 to get back to the zero based page number. it changes the answer to a string, so that the print command can understand the answer.
All you have to do is replace the second parameter "0" with this script and it will print the last page only:
xfa.host.print(1, (xfa.host.numPages -1).toString(), (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);
That will work for each help page, provided only one is visible at any one time. There is a way to deal with it if the help pages are in the middle of the form.
One last parameter I tend to change from the standard one is the fifth, which is scale to print. The standard is "0" - do not scale, but I tend to change that to "1" - scale to fit. This is completely opetional:
xfa.host.print(1, (xfa.host.numPages -1).toString(), (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);
Good luck,
Niall
Views
Replies
Total Likes
Thank you very much.
I had my hidden pages at the end so it was easy to insert the scripting.
Once again thank you very much for your assistance. My form should be going live within our organisation.
Jenny
Views
Replies
Total Likes