• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

event.fieldFull Not Working on Javascript Level

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

TOPICS
Acrobat SDK and JavaScript

Views

952

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
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 02, 2020 Jun 02, 2020

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. 

Votes

Translate

Translate
Community Expert ,
Jun 02, 2020 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. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines