5 Replies Latest reply on Jun 6, 2011 9:59 AM by dhoult

    Field name issues when spawning from template

    dhoult Level 1

      I am currently spawning a template multiple times in my document (with the field names being changed), but I am NOT spawning them at the end.  Rather, they all must get spawned to the same page.  This results in every corresponding field on every spawned page having the same prefix, e.g. P1.template.field.

       

      How can I avoid this?  Also, is there any way to remove the prefix from just a few field names that I actually WANT to be the same?

       

      Thanks!

        • 1. Re: Field name issues when spawning from template
          George_Johnson MVP & Adobe Community Professional

          For your first question, can your provide a bit of background and describe what you're trying to accomplish?

           

          For your last question, you can have more than one (hidden) template in a document, so you could set up another for just the fields that you want to be the same, and spawn it.

          • 2. Re: Field name issues when spawning from template
            dhoult Level 1

            For your first question, can your provide a bit of background and describe what you're trying to accomplish?

            To simplify this, pretend I have a single template.  My template has a textbox that the user fills.  When the user reaches the end, he must spawn a new page.  This page should appear immediately after the current one so he can continue typing.  However, if the user wants to go back and insert a page between two others, the document lets him do that.  The problem is that now the newly spawned page has the same field names as the page right after it because both were spawned at the same page number in the document.

             

            For your last question, you can have more than one (hidden) template in a document, so you could set up another for just the fields that you want to be the same, and spawn it.

            I would like these fields to appear on the same page as all the other fields... can you do that with multiple spawns?   For example, I have a text box on every spawned page with a title in it.  I'd like that text box to be identical on all the pages and reflect any changes to the title made on any of the pages.  If all the text boxes have different field names, I could write some script to change all the others, but I'd rather not have to add extra code if I can keep those few field names the same.

            • 3. Re: Field name issues when spawning from template
              George_Johnson MVP & Adobe Community Professional

              Just to get it out of the way, template spawning cannot work with Reader. Forgive me if you are aware of this, but many folks start working with templates only to discover this later. They actually can work with Reader, but only if the appropriate usage right has been applied with Adobe's LiveCycle Reader Extensions (which is not the same as LiveCycle Designer).

               

              Now on to the first question. I now understand the problem you're describing, and would suggest that you don't allow that to happen, and instead only allow a new page to be added after any others that have been spawned. You will have to somehow keep track of how many times a new page was created and where, but it's possible.

               

              For the second part, yes, you can spawn a template onto an existing page, any number of times.

              • 4. Re: Field name issues when spawning from template
                dhoult Level 1
                Now on to the first question. I now understand the problem you're describing, and would suggest that you don't allow that to happen, and instead only allow a new page to be added after any others that have been spawned. You will have to somehow keep track of how many times a new page was created and where, but it's possible.

                Unfortunately, this is a requirement for the document.  Only allowing pages to spawn at the end would make things much simpler, but that's just not an option for me.  Oh well...

                 

                For the second part, yes, you can spawn a template onto an existing page, any number of times.

                Oh, right... bOverlay... I'm so used to that being false.

                • 5. Re: Field name issues when spawning from template
                  dhoult Level 1

                  Came to my own solution:

                   

                  1.) Since the templates are being spawned with page number changes, go through all the fields and based on the parent names, determine which page numbers have been used.  Store this information.

                  2.) Insert the page at the lowest page number that hasn't been used.

                  3.) Move the page to where I want it.

                  4.) Repeat 2 and 3 whenever a page is inserted.

                   

                  Works like a charm.