These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Capture Enter in multiline text field

GlennOwns
Registered: Jun 30 2010
Posts: 18
Answered

So, I have a couple of Multi-Line text fields in Acrobat X Pro.
 
What I need is the field to jump to a desired field when it detects the enter key... The problem I'm faced with in a single-line text field is Adobe Acrobat jumping ahead of itself and executing the exit/blur cmd before completing the input of a long bar-code string. (32 characters, usually half gets inputted before acrobat loses focus based on the bar-code scanner's RETURN input that follows the inputted string, which are varying lengths). I am almost POSITIVE this is the reason it is happening.
 
I've tried every combination (charCode, commitKey, keyCode) within custom format script, keystroke script, validation script, and onBlue events. (none work).
  
Currently I have the following line inside custom keystroke..
 
if (event.charCode == 13)this.getField('nextFieldName').setFocus();
 
If anyone could help me, that would be much appreciated. I've had this problem for almost a year now and have only found little workarounds.

My Product Information:
Acrobat Pro 10.0.2, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
Two problems:
1. There's no such thing as event.charCode
2. Pressing enter in a form fields yields a line-feed, not a carriage-return.

Therefore, you should use this code:

if (event.change.charCodeAt(0) == 10) this.getField('nextFieldName').setFocus();

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

GlennOwns
Registered: Jun 30 2010
Posts: 18
try67, that is amazing.. I wish I had some formal training in Javascript, but everything has been self taught.
You've saved me bigtime. I have a system that was purchased a few days ago, due to arrive today. This PDF form was supposed to be the reason for purchasing; problem is, it broke a few days ago when we migrated to Win7!!!

Thank you so much, it works like a charm!