Highlighted

Filliable Forms

New Here ,
May 28, 2020

Copy link to clipboard

Copied

Is there a way to format a text field to so that once the area is consumed with text an additional preformatted page is added to the doc and text can continue in another field.  Ugh... I am new to this and I am trying to make a legal document with signatures and data required.  The text field is to small with everything else...  Any ideas?

 

Topics

Create PDFs, PDF forms

Views

458

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Filliable Forms

New Here ,
May 28, 2020

Copy link to clipboard

Copied

Is there a way to format a text field to so that once the area is consumed with text an additional preformatted page is added to the doc and text can continue in another field.  Ugh... I am new to this and I am trying to make a legal document with signatures and data required.  The text field is to small with everything else...  Any ideas?

 

Topics

Create PDFs, PDF forms

Views

459

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

Hi,

 

In the field that you want to be filled with text add a custom keystroke script.

 

Like this:

 

// declare a variable 

var a = this.getField("myTextField");

if (event.fieldFull) { 
   getField("myNextField").setFocus();
 }

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

Sorry I gave you incomplete  IF/ELSE statement and condition

 

 

 

 

var a = this.getField("myTextField");

if (event.fieldFull) {
  this.newPage({cPath:"/c/myDocuments/myNewPage.pdf", nPage:3 }); 

  getField("myNextField").setFocus();

}

 

 

 

 

I may be missing something, but see if this works. I haven't tested it.

 

NOTE: when you insert a new page keep in mind that in javascript the first page of a document in "0" , not 1.

 

So adjust that in your script to reflect at which page number  you'll insert the new page.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

Dude, you can't just make up code. Try looking it up in the reference before posting. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

Will do.   

 

I apologize. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

Please ignore everything ls_rbls has written. None of that code will work.

 

What you need is a "Page Template".  

You can read about them here:

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_Dev_Temp...

 

And if you search on this forum you'll find plenty of posts on the topic.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 29, 2020

Copy link to clipboard

Copied

Thom - Thank you I will be researching more and follow up

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 31, 2020

Copy link to clipboard

Copied

+++ EDITED REPLY, FIXED TYPOS REARRANGED PARAGRAPHS LOGICAL ORDER

 

 

To be very clear about Thom Parker's comment that "none that code will work", that is not true.

 

If you read carefully, my initial response  was trying to answer this part of your inquiry:

 

  • Is there a way to format a text field to so that once the area is consumed with text ...  and text can continue in another field?

 

MY ANSWER IS:

 

YES YOU CAN with this line of code:

 

 

 

var a = this.getField("myTextField");

if (event.fieldFull) { 
   getField("myNextField").setFocus();
 }

 

 

 

That little keystroke  line of script  allows you to continue to type from one textfield to the other specified texfield in the script when you cannot type anymore characters in the first field.

 

So whatever it is the method you decide to use to insert a page, whether it be a template or using the this.insertPages   method, this part of my answer to your question is actually a correct answer.

 

Try it out! 

 

I am starting to notice a tendency of users that doesn't even dare to try my suggestions when an ACP joins the discussion.

 

If it works use it.

 

Let's not forget that I am an Adobe customer not an ACP.

 

As such there are many occasion that I don't have the time to read so much. I need to get my life at work going.

 

AND , Just to clarify my lack of JavaScript knowledge and not providing you with the correct reference at this time,  I was going by a tutorial that Thom Parker posted, but I didn't read it hard enough and I didn't have it handy.

 

For the line below I initially consulted the Acrobat JavaScript Scripting Reference page 175 : 

 

 

 

  this.newPage({cPath:"/c/myDocuments/myNewPage.pdf", nPage:3 }); 

 

 

 

The original example code was this:

 

 

 

Example
Insert a cover page to the current document.
this.insertPages
({
nPage: -1,
cPath: "/c/temp/myCoverPage.pdf",
nStart: 0
});

 

 

 

I wasn't thinking of templates because I thought this approach was possible.

 

There is a lot more involved to it and  complicated though.

 

In order to execute it has to be done from a privileged context, and I quote:  " a Privileged Context means this operation cannot be done from a Document Level script, i.e., documents can’t insert pages into themselves. This has to be done from an Application Level script."

 

This note (taken from the link below)  is not explained as clearly in the  Acrobat JavaScript Scripting Reference , but Thom Parker breaks it down in one of his always excellent tutorials: https://acrobatusers.com/tutorials/inserting-pages-pdf-acrobat-javascript1/

 

So I'm not sure why he preferred the template method when he already  had it all  explained there in that tutorial.

 

Yet again, I don't know enough programming to rebuttle his vast experience.

 

Again, I apologize to both of you, specially Thom.

 

It really gives Adobe customer an unprofessional aftertaste when I've provided crappy javascript answers.

 

However, I am not embarassed at all to admit that I am at a very premature stage of learning JavaScript and to realize the fact that just in 10 months of coming here to the forums every day, has allow me to provide insights to other users while trying to measure up with the big boys of the Adobe support forums.

 

The way I look at it is,  that  I get off of  my butt everyday to come here and try to help the community outside of my real life job  which has nothing to do with computers at this time (without getting paid, without running a freelance business from home, and completely on a voluntary basis).

 

Besides, I don't have the money to cost the expenses associated with a degree in computer science at this time, so this is my schooling right here. 

 

On the other hand (and as stupid as it may sound), I would still prefer to use this method though, because the first line of code that I posted (shown below), works very well in my forms:

 

 

 

var a = this.getField("myTextField");

if (event.fieldFull) { 
   getField("myNextField").setFocus();
 }

 

 

 

This line of code partially answers your inquiry: 

 

I adopted the line above from reading other forums outside of the Adobe community and  the JavaScript Scripting refrence using the examples for setFocus provided in Page 266,  and for  event.FieldFull in page 213 where it shows this particular example: :

 

 

 

Type: Boolean Access: R Events: Keystroke.
Example
Test whether user has overfilled the text field.
// Custom Keystroke script for a text field. Initially, the field is set
// so that text does not scroll.
if ( event.fieldFull )
{
app.alert("You've filled the given space with text,"
+ " and as a result, you've lost some text. I'll set the field to"
+ " scroll horizontally, and paste in the rest of your"
+ " missing text.");
event.target.doNotScroll = false;
event.change = event.changeEx;
}

 

 

 

So , these were my initial references to answer you.

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 31, 2020

Copy link to clipboard

Copied

Look, it's great to be involved in the forums. Of course we need all help we can get, and everyone is welcome. But this is not a social platform. It's technical, and the best way to contribute is to provide concise, accurate, and well reasoned technical responses. If you don't have the information necessary to provide such an answer it is better not to respond. Bad information doesn't go away, it just hangs around causing confusion and future problems. 

 

So, to address the technical issue. Page insertion not only requires privilege, it cannot be done from Reader. So this is a wholly inappropriate solution for a form script, which will need to be run in Reader, and without a privileged assist.  Page templates on the other hand do not require privilege and do work in Reader. 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
ls_rbls LATEST
Adobe Community Professional ,
May 31, 2020

Copy link to clipboard

Copied

All acknowledged Thom.

 

I will better myself. 

 

Thank you.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF