Copy link to clipboard
Copied
I have a text field "Employeenumber" with format set to number, which can take values of 1-20.
I also have a few text fields to fill in for each employee.
I would like to create a button that fills in the forms for employees 2-20 by copying the information already filled in for employee 1. The thing is, I would like to be able to control to how many employees the information flows, depending on the number which has already been introduced at "Employeenumber".
So, I have made a button in which I planned to use the java script below at mouse down, but I think I missed something in the code, as it doesn't work (i added the code for value "2" only, but I plan to create similar if clause for the numbers 3-20).
if(this.getField("EmployeeNumber") == '2')
{
this.getField("Employee2data").value = this.getField("Employee1data ").value;
}
Can someone help?
Thank you so much!
You must use the value of the field. E.g.:
if(this.getField("EmployeeNumber").valueAsString == '2')
Copy link to clipboard
Copied
I'm assuming you're working in Acrobat, so I'm going to move this to the Acrobat forum. If I'm wrong, say which program you're working with and someone will move the post to the appropriate forum.
The Using the Community forum is for help in using the Adobe Support Community forums, not for help with specific programs. Product questions should be posted in the associated product community.
Copy link to clipboard
Copied
Thank you! I'm working with Acrobat, indeed.
Copy link to clipboard
Copied
You must use the value of the field. E.g.:
if(this.getField("EmployeeNumber").valueAsString == '2')
Copy link to clipboard
Copied
This worked! Thank you so much for your help!