Highlighted

event.fieldFull Not Working on Javascript Level

Explorer ,
Jun 02, 2020

Copy link to clipboard

Copied

Hello all,

 

I'm attempting to write a script that enters text into an Acrobat field via Javascript but prevents additional text from being entered once it hits the field bounds. My problem is, unlike when entering text manually, the fieldFull keystroke event property is not triggered when populating a field via Javascript. Here's an example below:

var f.addField('name', 'text', 0, [0, 200, 200, 0]);
f.multiline = false;
f.doNotScroll = true;
f.textSize = 36;
				
f.setAction('Keystroke', 'app.alert(event.fieldFull)');

var contents = 'I am a sentence.';		
for (var i = 0; i < contents.length; i++) {
  f.value += contents[i];
}

The listener detects the keystrokes just fine, but for whatever reason event.fieldFull is returning false regardless of whether the text is outside the field bounds (aaand the script continues to enter text despite the fact that doNotScroll is enabled).

 

Any reason why this is or any possible workarounds? Thanks in advance! 🙂

Adobe Community Professional
Correct answer by Thom_Parker | Adobe Community Professional

There are two types of keystroke event, commited and uncommitted. you need to use the "event.willCommit" property to differenciate them. "event.fieldFull" is only valid for the uncommitted event. which only happens when the user is actually typing into the field.  

 

That's just the way it works. This functionality was never very useful. You can find posts from almost 20 years ago where people are complaining about the same (or similar) thing.

Put a character limit on the field. 

Topics

Acrobat SDK and JavaScript, PDF forms

Views

240

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

event.fieldFull Not Working on Javascript Level

Explorer ,
Jun 02, 2020

Copy link to clipboard

Copied

Hello all,

 

I'm attempting to write a script that enters text into an Acrobat field via Javascript but prevents additional text from being entered once it hits the field bounds. My problem is, unlike when entering text manually, the fieldFull keystroke event property is not triggered when populating a field via Javascript. Here's an example below:

var f.addField('name', 'text', 0, [0, 200, 200, 0]);
f.multiline = false;
f.doNotScroll = true;
f.textSize = 36;
				
f.setAction('Keystroke', 'app.alert(event.fieldFull)');

var contents = 'I am a sentence.';		
for (var i = 0; i < contents.length; i++) {
  f.value += contents[i];
}

The listener detects the keystrokes just fine, but for whatever reason event.fieldFull is returning false regardless of whether the text is outside the field bounds (aaand the script continues to enter text despite the fact that doNotScroll is enabled).

 

Any reason why this is or any possible workarounds? Thanks in advance! 🙂

Adobe Community Professional
Correct answer by Thom_Parker | Adobe Community Professional

There are two types of keystroke event, commited and uncommitted. you need to use the "event.willCommit" property to differenciate them. "event.fieldFull" is only valid for the uncommitted event. which only happens when the user is actually typing into the field.  

 

That's just the way it works. This functionality was never very useful. You can find posts from almost 20 years ago where people are complaining about the same (or similar) thing.

Put a character limit on the field. 

Topics

Acrobat SDK and JavaScript, PDF forms

Views

241

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 ,
Jun 02, 2020

Copy link to clipboard

Copied

There are two types of keystroke event, commited and uncommitted. you need to use the "event.willCommit" property to differenciate them. "event.fieldFull" is only valid for the uncommitted event. which only happens when the user is actually typing into the field.  

 

That's just the way it works. This functionality was never very useful. You can find posts from almost 20 years ago where people are complaining about the same (or similar) thing.

Put a character limit on the field. 

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...
Explorer ,
Jun 03, 2020

Copy link to clipboard

Copied

Bummer, I was hoping this wasn't the case. Thanks for the response—appreciate the explanation.

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