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

Javascript Woes

dennismonsewicz
Registered: Feb 11 2010
Posts: 8

I am having a big problem with some javascript I am trying to write...

On one of my fields in the PDF I am trying to run an extra validation to set the focus on another field upon the current field being full...

if(event.fieldFull)
app.alert("HEY!");

The code above does not work... any ideas?

try67
Expert
Registered: Oct 30 2008
Posts: 2399
How is this supposed to set the focus of another field? It will just display a message when the field is full.

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

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You have to use the 'setFocus()' method of the doc object.

George Kaiser

try67
Expert
Registered: Oct 30 2008
Posts: 2399
Actually, setFocus() is a method of the Field object, not the doc object, so you have to use:
this.getField("field_name").setFocus();

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

dennismonsewicz
Registered: Feb 11 2010
Posts: 8
Well do I place my Javascript under the validate tab when you right click on a field and click on properties? Cause that is not working right now