Link to home
Start Free TrialLog in
Avatar of DMackallii
DMackallii

asked on

Acroform Javascript-How to copy using a loop?

Greetings All;

Using Adobe Acrobat v8.12 (for WIN)/Javascript how can I copy the semi-colon separated values of TEXTBOX1 into TEXTBOX2? (while adding a sequential ID in front of each copied values (minus the semi-colon)?

Copied values can be separated by a single blank space.

See illustraion below.

I have a working javascript for copying single or multiple selected values of a listbox into a textbox, but can't seem to get it modified correctly. HELLLLPPPPPP!

Thank you for you time and consideration.
´*•.¸(`*•.¸?¸.•*´)¸.•*´
?*°Doris 42DoubleDDs*°•´»?
.¸.•*(¸.•*´?`*•.¸) *•.¸

Listbox1 to Text1 Version

Custom calculate Keyboard Script in "text1" field:


var textFieldNewValue = ""
 
var f = this.getField("listbox1");
var a = f.currentValueIndices;
 
if (typeof a == "number") // A single selection
{
     textFieldNewValue = f.getItemAt(a, false);
}
else // Multiple selections
{
    console.println("Selection:");
    for (var i = 0; i < a.length; i ++)
    {
        if (i!=0)
        {
            textFieldNewValue += " ";
        }
         textFieldNewValue += f.getItemAt(a[i], false);
    }
}
 
event.target.value = textFieldNewValue;

Open in new window

EE-Acroform-Copy-Question-031911.jpg
EE-Acroform-Copy-Test-File.pdf
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DMackallii
DMackallii

ASKER

leakim971...once again you make seem so easy!. THANK YOU so very much!. That's exacly what I was looking for.

´*•.¸(`*•.¸?¸.•*´)¸.•*´
?*°Doris 42DoubleDDs*°•´»?
.¸.•*(¸.•*´?`*•.¸) *•.¸