Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Copy Text Field To Another

jrvh924
Level 3
Level 3

Hello,


I am trying to copy one text field, EmployeeName, to another, Contacts, for an incident report form I created in LiveCycle.  I am still new with Javascript, and have found this code which I thought would work:

getField("EmployeeName").value == getField("Contacts").valueAsString;

The problem I am facing is that I cannot get it to work.  What I would like to have whatever is typed into the EmployeeName field to also be put into the Contacts field.  I cannot use a global binding as the Contacts will be different than the EmployeeName. 


Any suggestions on what to do?

Thank you,


Justin

1 Accepted Solution
kvdvijaykumar
Correct answer by
Level 4
Level 4

Hi jrvh924,

Say that your source field path is form.EmployeeName.txtEmpName

Say that your dest. field path is form.Contacts.txtContactName

Then adding the following code should work:

form.Contacts.txtContactName.rawValue = form.EmployeeName.txtEmpName.rawValue;

Please Note : I'm not sure what is wrong with your following script.. Infact, i don't recognize what style of scripting it is. But u can try changing the  = = to = in your following script.

getField("EmployeeName").value = getField("Contacts").valueAsString;

Thanks,

VJ

View solution in original post

0 Replies
kvdvijaykumar
Correct answer by
Level 4
Level 4

Hi jrvh924,

Say that your source field path is form.EmployeeName.txtEmpName

Say that your dest. field path is form.Contacts.txtContactName

Then adding the following code should work:

form.Contacts.txtContactName.rawValue = form.EmployeeName.txtEmpName.rawValue;

Please Note : I'm not sure what is wrong with your following script.. Infact, i don't recognize what style of scripting it is. But u can try changing the  = = to = in your following script.

getField("EmployeeName").value = getField("Contacts").valueAsString;

Thanks,

VJ

View solution in original post

jrvh924
Level 3
Level 3

VJ,


That did it!  I found the script online which, I thought should work, but it did not.  Your code, however, works exactly as I need it to. Thank you!!


Justin         

George_Johnson
Level 6
Level 6

That code you found earlier is for a form created in Acrobat, not an XFA form created in LiveCycle Designer, and VJ is right about the correction.