Skip to main content
Participant
March 19, 2021
Question

Fillable pdf and text wrapping

  • March 19, 2021
  • 1 reply
  • 1294 views

Hello,

 

I am trying to get type to flow from one text box to another but every script I try isn't working. I'm not sure what I'm doing wrong. I have typed the script in and pasted the script. Is there anyone that has any knowledge of how I can make this work? Thank you for your help.

This topic has been closed for replies.

1 reply

ls_rbls
Community Expert
Community Expert
March 20, 2021

Please share what script are you using.

 

Also, would you mind providing more info on what you mean by text wrapping and flowing from one textfield to another?

Participant
March 22, 2021

Hello,

 

This is the script I have tried amongst others. 

if (event.fieldFull || event.willCommit) this.getField("What happened 2").setFocus();

 

I have attached photos of my document as well for reference. I don't want to use one box with the multiline function as it is difficult to adjust the leading and I want the type to line up above the line.

ls_rbls
Community Expert
Community Expert
March 22, 2021

I am still learning JavaScript and at a first glance it seems like there's nothing wrong with the script.

 

But I would've declared the willCommit event slightly different, and I would use this script as a Custom Keystroke Script.

 

Make sure this is where you're running the willCommit event from. 

 

Hopefully someone with more experience can confirm if what I'm observing is correct.

 

But anyhow, this how I would use your script as a Custom Keystroke event:

 

if (event.willCommit) {

 

     if (event.fieldFull)       this.getField("What happened 2").setFocus();

 

}

 

Like I said, I am unsure if I did it right, but I am typing from a mobile device and I haven't tested if the script above is OK or will throw any errors.

 

However,  I think the most important observation is that I noticed that the texfield objects have very long name as sentence phrasing with spaces in between words.

 

That is not a good field object naming convention when using Acrobat JavaScript since it is known for sometimes throwing errors, specially if a field object is used for calculating events.

 

I would suggest to first try your original script  but changing the fieldnames to something short and preferably using a parent-child naming hierarchy, like for example:

 

"How.0", "How.1", "How.2", etc.

 

"What.0", "What.1", "What.2"

 

"Change.0", "Change.1", "Change.2", 

 

Let us know if this helps.