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

Extract last four characters of a textfield1 and populate it in textfield2

Bob Casey
Registered: Aug 5 2009
Posts: 22
Answered

Hello
 
I am trying to figure out how to extract the last four characters of a text field, and populate those characters into another text field.
 
For example textfiled1 is populated with "123456789", and would like have
textfield2 reveal "6789"
 
I am using Acrobat 8.17
 
Thank you in advance for your help

My Product Information:
Acrobat Pro 8.1.7, Windows
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1875
In the Validate event of textfield1, you could do something like:

var f2 = getField("textfield2");
if (event.value.length > 3) {
f2.value = event.value.substr(-4);
} else {
f2.value = "";
}