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

Setting Focus on a Field after Validation

CSDesigner
Registered: Jun 20 2011
Posts: 11
Answered

I am currently working on a form that requires the entry to be validated based on another fields total. I have two problems
1. For some reason I cannot get the script to work in the validation section, only in the onBlur for the fields custom script.
2. I want to set focus on the previous field and then zero out the entry. Here is the code I have currently: ("tper" is a running total of entries)
 
if (this.getField("tper").value > 100) {
// User alert
app.alert("Total percents entered must = 100%. Please check your entries.");
this.getfield("the field that had the focus").setfocus();
event.value = 0;
}
 
I believe I may be calling the previous field improperly. Any help is appreciated.
 
Aaron

My Product Information:
Acrobat Pro 9.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Try using event.value instead of getField().value in the first line.
Also, are there error messages in the console?

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

CSDesigner
Registered: Jun 20 2011
Posts: 11
Error:
TypeError: this.getfield is not a function
3:Field:Blur

I will try the event.value

Thank you
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
Accepted Answer
CSDesigner wrote:
TypeError: this.getfield is not a function

"getfield" is not a function, but "getField" is.

CSDesigner
Registered: Jun 20 2011
Posts: 11
So used to Visual Basic that I often forget Case Sensitivity matters. Thanks everyone for the assistance.