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

How do I copy data from text1 to text2

crayzme
Registered: Dec 4 2009
Posts: 27
Answered

Sorry for a question that is probably so simple to do using a getthis comand but I am a JavaScript Virgin and am trying hard to learn as much as possible from these forums.

I have two Text Fields on a form

Text1 and RX.UniqueID

My software system can auto pupulate the RX.UniqueID field but I cannot run a customJava Script from this field because of the naming convention I am bound to. So to work around I have a text field where the user has to manually copy the data into to run an autopopulate java script.

How can I make the data that my software drops into RX.UniqueID automatically copy into my Text1 field?

Your help is grealy appreciated!!!!!!!!!!!

Thanks

- Tom

My Product Information:
Acrobat Pro 8.1.7, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
In the field's calculation options, under simplified field annotation, just write in the name of the field from which you want to copy the data.

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

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Since there is a 'dot' in one of the field names, you will need to use a custom calculation script.

// copy the string value of the RX.UniqueID field so leading zeros maintainedevent.value =  this.getField('RX.UniqueID').valueAsString;

If I use the 'simplified field notation', I receive the following errors on the JavaScript Debugging console:
Quote:
invalid assignment left-hand side
45:
AFMakeNumber(getField("RX").value) has no properties
2:Field:Calculate
AFMakeNumber(getField("RX").value) has no properties
2:Field:Calculate
AFMakeNumber(getField("RX").value) has no properties
3:Field:Calculate

George Kaiser

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Yes, the dot might cause a problem...
In that case, a simple JavaScript will do the job.

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

crayzme
Registered: Dec 4 2009
Posts: 27
How do i make this work?

I pasted the above script into cusom calculation of my text1 box and when I populate data into the RX.UniquieID nothing happens...
crayzme
Registered: Dec 4 2009
Posts: 27
aHHHHH POOP!
It worked on my test form but when I tried on my real for i forgot an important factor...

Already on my TEXT1 box in the custom keyestroke script I have the following:

if( event.willCommit )
{
if(event.value == "")
this.resetForm(["DrName","DrAddress","DrPhone","DrFax","DrDEA","DrAddress2"]);
else
SetFieldValues(event.value);
}


I tried to have both but it wouldnt work... Any suggestions?
crayzme
Registered: Dec 4 2009
Posts: 27
is there anyway to have both scripts run in sequence?

First:

event.value = this.getField('RX.UniqueID').valueAsString;



Second:

if( event.willCommit )
{
if(event.value == "")
this.resetForm(["DrName","DrAddress","DrPhone","DrFax","DrDEA","DrAddress2"]);
else
SetFieldValues(event.value);
}
crayzme
Registered: Dec 4 2009
Posts: 27
Got it to work.... My vendor modified their software to _ instead of .

Thanks for your help!