Hello,
I have a form where there is a button that allows the user to add a new set of the first four pages of the form. The cursor automatically based on the script sets the focus on the first field in the first page of the new set of 4 pages. That all works great. This allows the end user to add as many sets of 4 pages as needed.
Now the business owner of the form, wants to be able to jump to the first page of any of the added sets. I know how to script to jump to a specific page when there are a set number of pages, but I don't know how to jump to the first page of a set that hasn't been added yet. I'd appreciate any help that's offered!
Thanks,
MDawn
Solved! Go to Solution.
Views
Replies
Total Likes
Ahh I think I already found out what you want to do.
Use this script for the addNestedTerm button.
_pages1_3.addInstance(1)
xfa.host.setFocus(xfa.resolveNode("pages1_3[" + (_pages1_3.count - 1) + "]").spot.TextField9.somExpression);
To set focus from the Go to next nested term button use this script.
var i = this.parent.parent.index;
if (i < _pages1_3.count - 1) {
xfa.host.setFocus(xfa.resolveNode("pages1_3[" + (i + 1) + "]").spot.TextField9.somExpression);
}
hope this helps.
Views
Replies
Total Likes
This is possible with a counter of the repeated objects.
Here's an example.
Replace "subform1" with the name or Som expression of your subform.
xfa.host.setFocus(subform1[xfa.resolveNodes("subform1[*]").length - 1].textField1.somExpression);
Views
Replies
Total Likes
Thanks for your quick response.
I put this script in the click event of a button I created to let the user click the button to jump to the first page of the next set of pages. I replaced the subform1 for the name of the subform and I changed the textField1 to the name of the field where the cursor should appear. But I'm not sure what to put for somExpression in your example.
Thanks,
MDawn
Views
Replies
Total Likes
Hi,
somExpression is a scripting property that returns the SOM expression of the object written in front of the property.
subform1[xfa.resolveNodes("subform1[*]").length - 1].textField1.somExpression returns a SOM expression like form1[0].page[0].subform1[3].textField1[0]
Views
Replies
Total Likes
Could I share my form with you? I'm not able to get this to work.
Thanks,
MDawn
Views
Replies
Total Likes
Sure,
upload the form somewhere and post a link here.
Views
Replies
Total Likes
Here's the link:
https://files.acrobat.com/folder/348612a4-e8fb-4a5d-a860-e97789f05228
It's called the True Up Checklist. I put the script in question in the Go to next Nested Term button seen on page 1.
Thanks,
MDawn
Views
Replies
Total Likes
I don't have access to the file, make sure you shared it. ;-)
Views
Replies
Total Likes
Now is says 'shared'. Will it be the same link?
mdawn
Views
Replies
Total Likes
Views
Replies
Total Likes
You said a button will new instances of the 4 pages. Which button is it?
Views
Replies
Total Likes
The button that adds the new instance is on page 5. It's called Add Nested Term. The script there works fine.
The button to jump to the first page of an added instance is on page 1 and then on the first page of each added instance. It's called 'Go to Next Nested Term.'
Thanks,
MDawn
Views
Replies
Total Likes
Ahh I think I already found out what you want to do.
Use this script for the addNestedTerm button.
_pages1_3.addInstance(1)
xfa.host.setFocus(xfa.resolveNode("pages1_3[" + (_pages1_3.count - 1) + "]").spot.TextField9.somExpression);
To set focus from the Go to next nested term button use this script.
var i = this.parent.parent.index;
if (i < _pages1_3.count - 1) {
xfa.host.setFocus(xfa.resolveNode("pages1_3[" + (i + 1) + "]").spot.TextField9.somExpression);
}
hope this helps.
Views
Replies
Total Likes
Great! That works. Now I need to study them and figure out why they worked.
Thank you,
MDawn
Views
Replies
Total Likes
Sorry to keep bothering you. Is there a way to change the script for another button that would take the user to the previous nested term?
Thanks,
MDawn
Views
Replies
Total Likes
Views
Likes
Replies