Great tutorial Ted, thank you very much. Question: how can I limit the number of additional pages to just adding one page? (in this solution I will add as many pages as I use the button) and can such a script be added to a CHECKBOX instead of a button?
Good question. Yes you can add a script to a checkbox and write the script so it deletes the button that you set up to spawn the page. Simply add the following code as a Run a JavaScript Action in your checkbox field. Code you add is: this.removeField("field name"); I'll be adding another video in a few days where I cover calculating fields on checkbox actions and how to enable/disable checkboxes using scripts. It may be of some additional help to you. Look for the new video titled "Calculating checkbox Values" to be posted in a few days.
A question on the spawning of templates. I'm attempting to redo my agency's ecidence forms. The template I want to spawn is an exact copy of the first page. This is because in our current form you only have enough room for a few items if evidence. When you run out, you have to open a second document and re-enter all the info (case#, suspect/owner info, and all the other data that is the same as the first and make sure you put the correct # of X pages ). How would I set it up (if possible) to spawn additional identical pages with the info that needs to be the same (some of the info is in dropdowns) but keep the evidence boxes clear so you can continue to enter your evidence items. This would make things quite a bit more efficient for officers. And allow all of these pages to be in one file and be printed all at once. Thanks in advance!
When you spawn a page form a template, all form fields on the spawned page are set up as unique fields. We could write some JavaScript to duplicate the fields but that might be quite a bit of programming. You might try duplicating the original page as many times as you might need additional pages. Create form fields with the same name for those fields where you need to duplicate data and unique fields for fields that require different data. Hide the duplicate pages. Add a button to Show/Hide pages and advance the view to the next page after you Show it. You won't need to create templates or spawn pages from a template.
Hi Ted ! ...thanks for this precious video ...i was searching how to add pages to my document since so much time !! ...question is...do you think it could be possible to add a small java script to make the contrary ... i mean for example if someone click by mistake on the link and add new pages that actually he didn't wanted ? thanks by advance . Remi (France)
There are a few ways you could handle this. You can add Delete Pages buttons (see my recent video "Spawning Pages with Duplicate Data"). This means the remove pages button resides in the document on every page. If a user accidentally hits the button without meaning to, there's no way to get the page with the data back. You could use a Page Action JavaScript so after a page is spawned, the user adds data, then when they leave the page the Delete Pages button is removed. Another way would be to use an Application Response dialog box. When the button is clicked to spawn a page, a dialog box opens asking the user to confirm the spawn page action. If they click Yes, a page is spawned. If No, then nothing happens.
You could add a JavaScript that can add multiple pages. (see my recent video "Spawning Pages with Duplicate Data". It shows spawning two pages with one script.)
Hi Ted. Thanks for the video and downloadable file. I have the button on page 2 and I am trying to add a template to page 3 by using this this.pageNum = 2; but that does not work. It keeps adding to the end of the doc. I have also tried this.pageNum = this.numPages + 1; so that it adds it to the end of the current page where the button is, that fails as well. Any help would be greatly appreciated.
add the following script after this.pageNum = this.numPages -1. Follow that line with: this.movePage(1); where 1 = page 2 in the document. Change the number to the page number you want. Remember, JavaScript is zero based so if you want the page to appear on page 5 use (4).
I don't know if my first reply actually helps you. I'm going to upload a few more PDFs with Spawn Pages actions that will hopefully answer your question. Just give me a little time to set them up.
You can see in my script the line" this.pageNum = this.numPages - 1; That line of code places the new spawned page at the end of the document. JavaScript is zero based therefore the code gets the total number of pages and subtracts 1 from it. If you want to place the new page on page 4 (for example) you would use the following script" this.pageNum = 3; (4 minus one is 3). However if you are continually spawning new pages, then obviously the number of pages will increase. If you want to add all new pages at various locations, you might want to add a counter field on a home page, make it invisible and read only and increment the value each time you add a new page.
www.tedpadova.com/acro/spawnPages.pdf
Great tutorial Ted, thank you very much. Question: how can I limit the number of additional pages to just adding one page? (in this solution I will add as many pages as I use the button) and can such a script be added to a CHECKBOX instead of a button?
Good question. Yes you can add a script to a checkbox and write the script so it deletes the button that you set up to spawn the page. Simply add the following code as a Run a JavaScript Action in your checkbox field. Code you add is:
this.removeField("field name");
I'll be adding another video in a few days where I cover calculating fields on checkbox actions and how to enable/disable checkboxes using scripts. It may be of some additional help to you. Look for the new video titled "Calculating checkbox Values" to be posted in a few days.
Corrected link above.
A question on the spawning of templates. I'm attempting to redo my agency's ecidence forms. The template I want to spawn is an exact copy of the first page. This is because in our current form you only have enough room for a few items if evidence. When you run out, you have to open a second document and re-enter all the info (case#, suspect/owner info, and all the other data that is the same as the first and make sure you put the correct # of X pages ). How would I set it up (if possible) to spawn additional identical pages with the info that needs to be the same (some of the info is in dropdowns) but keep the evidence boxes clear so you can continue to enter your evidence items.
This would make things quite a bit more efficient for officers. And allow all of these pages to be in one file and be printed all at once.
Thanks in advance!
When you spawn a page form a template, all form fields on the spawned page are set up as unique fields. We could write some JavaScript to duplicate the fields but that might be quite a bit of programming. You might try duplicating the original page as many times as you might need additional pages. Create form fields with the same name for those fields where you need to duplicate data and unique fields for fields that require different data. Hide the duplicate pages. Add a button to Show/Hide pages and advance the view to the next page after you Show it. You won't need to create templates or spawn pages from a template.
I'm going to upload a couple more PDFs with scripts that answer your question a few others. I'll try to get to it soon.
See the video I uploaded recently ("Spawning Pages with Duplicate Data") and see if it comes close to answering your question.
Hi Ted ! ...thanks for this precious video ...i was searching how to add pages to my document since so much time !! ...question is...do you think it could be possible to add a small java script to make the contrary ... i mean for example if someone click by mistake on the link and add new pages that actually he didn't wanted ? thanks by advance . Remi (France)
There are a few ways you could handle this. You can add Delete Pages buttons (see my recent video "Spawning Pages with Duplicate Data"). This means the remove pages button resides in the document on every page. If a user accidentally hits the button without meaning to, there's no way to get the page with the data back. You could use a Page Action JavaScript so after a page is spawned, the user adds data, then when they leave the page the Delete Pages button is removed. Another way would be to use an Application Response dialog box. When the button is clicked to spawn a page, a dialog box opens asking the user to confirm the spawn page action. If they click Yes, a page is spawned. If No, then nothing happens.
And i have one more question ...is it possible to add more than 1 page in one click ? Thanks
You could add a JavaScript that can add multiple pages. (see my recent video "Spawning Pages with Duplicate Data". It shows spawning two pages with one script.)
Hi Ted. Thanks for the video and downloadable file. I have the button on page 2 and I am trying to add a template to page 3 by using this this.pageNum = 2; but that does not work. It keeps adding to the end of the doc. I have also tried this.pageNum = this.numPages + 1; so that it adds it to the end of the current page where the button is, that fails as well. Any help would be greatly appreciated.
add the following script after this.pageNum = this.numPages -1. Follow that line with: this.movePage(1); where 1 = page 2 in the document. Change the number to the page number you want. Remember, JavaScript is zero based so if you want the page to appear on page 5 use (4).
worked like a charm@@tedpadova7633
I don't know if my first reply actually helps you. I'm going to upload a few more PDFs with Spawn Pages actions that will hopefully answer your question. Just give me a little time to set them up.
See my latest video and see if it comes close to answering your question.
Is there a way that spawned pages aren't linked to each other? If I type info on one its apply to all the pages. Thanks
Change bRename in the script from false to true
My recent video (see my recent video "Spawning Pages with Duplicate Data"). Not sure if it answers your question. Take a look and see.
how do I get the template to spawn on a particular page instead of at the end of the document?
You can see in my script the line" this.pageNum = this.numPages - 1;
That line of code places the new spawned page at the end of the document. JavaScript is zero based therefore the code gets the total number of pages and subtracts 1 from it. If you want to place the new page on page 4 (for example) you would use the following script" this.pageNum = 3; (4 minus one is 3). However if you are continually spawning new pages, then obviously the number of pages will increase. If you want to add all new pages at various locations, you might want to add a counter field on a home page, make it invisible and read only and increment the value each time you add a new page.
See comment above.
See my latest video where I talk about spawning pages at different locations.
Exactly wat I want.
That's a pit don't have a free program to do this task.
The download link is broken "404 Not Found"
My apologies. Please use this link: www.tedpadova.com/acro/spawnPages.pdf