[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Acroform Javascript-How to copy using a loop?

Posted on 2011-03-18
2
Medium Priority
?
935 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:DMackallii
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 35173852
Check this :


var s = this.getField("TEXTBOX1").value;
s = s.split(/;\s*\r*\n*/)

this.getField("TEXTBOX2").value = ""
for(var i=0;i<s.length;i++) {
  var p = ("000" + i);
  p = p.substr(p.length-4,4);
  if(i==0) {
     this.getField("TEXTBOX2").value += p + " " + s[i]; 
  }
  else {
     this.getField("TEXTBOX2").value += " " + p + " " + s[i]; 
  }
}

Open in new window

0
 

Author Closing Comment

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

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

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Tech spooks aren't just for those who are tech savvy, it also happens to those of us running a business. Check out the top tech spooks for business owners.
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question