Here is some revised code, please make sure to change the variable names to suit your program's needs. var oFile = util.readFileIntoStream("/Macintosh HD/Users/na***an/Documents/M***EY/So***ts.txt"); var cFile = util.stringFromStream(oFile, "utf-8"); var yourCode = cFile.split("\n"); var i; var arrayGet = []; //We need to get the drop down field where you want to insert the company names. //Change these values to suit your PDF's means. var testBox = this.getField("testBox"); //this code is revised for your situation, we have parsed the text file by tab for the //loop, allowing you to grab only the company name to insert into your drop down box. for (i = 0; i < yourCode.length; i++){ var tempArray = yourCode.split('\t'); arrayGet.push(tempArray[0]); } //We are inserting the Array of company names into the drop down box //Change variable names as necessary. testBox.setItems(arrayGet); //For the program to change the values of other form fields based on the company name they select //I recommend using the 'this.getField("fieldname");' method, and creating //custom calculations based on what your drop down box's value is. testBox.setItems(arrayGet); //For the program to change the values of other form fields based on the company name they select //I recommend using the 'this.getField("fieldname");' method, and creating //custom calculations based on what your drop down box's value is. I have tested this out, and the entire first column should be inserted into the drop down box. As in the code, change the variables, and create custom calculations based on what the value of the drop down box is. To run a calculation based on whatever company is set in the box, try: if(testBox.valueAsString == "Microsoft"){ field_one.value = "Bill Gates"; } '.valueAsString' is how to check the selected value of the drop down box, and is a good way to run statements in your code. If you need any more help, ask away!
... View more