Quantcast
Viewing all articles
Browse latest Browse all 73766

Acrobat X Pro, Drop Down with Lots of options+filling 2 other fields

I have 3 columns of particular interest. The current form uses 2 drop down boxes, and one manual text box.

I'm interested in refining the process. I'd like to pick the one most significant data from the first drop down list and it would then fill the 2 other boxes with appropriate, predetermined data.

 

I did find http://acrobatusers.com/tutorials/change_another_field which has lead to much testing, & I keep failing.

I copy the JS into Word twice, then attempt to replace keywords with the box titles and other variables I'm using.

 

What is the correct way to list Lots of items from the drop down box? It's item numbers. ###-### format. Is that a problem?  (I think it is) What suggestions might you have for a work around? (custom number format the item column of boxes?)

Oh, that other part from the guide is in there too (within properties, custom format for item boxes):

 

//<AcroForm>

//<ACRO_source>Item0:Keystroke</ACRO_source>

//<ACRO_script>

/*********** belongs to: AcroForm:Item0:Keystroke ***********/

if( event.willCommit )

{

   if(event.value == " ")

     this.resetForm(["Description.0","Price.0"]);

   else

     SetFieldValues(event.value);

}

//</ACRO_script>

//</AcroForm>

 

Next fun part is matching the few descriptions with the Lots of Item Numbers. Reusing descriptions across a list of item numbers.

The last fun column of boxes is price. Again few prices across Lots of item numbers.

 

Meanwhile, BIG Thanks to Thom Parker and I've been using the guide I linked above:

Open Form. Edit. JS. Document JS: SetFieldValues

 

// Place all prepopulation data into a single data structure

var DeptData = { Accounting:{ contact: "Steala Damuni",

email: "accounting@mycomp.com",

deptnum: "cmp1234" },

                 Engineering:{ contact: "Frank N. Stien",

email: "engineering@mycomp.com",

deptnum: "eng1234" },

Marketing :{ contact: "Shelly Oughtbuks",

email: "marketing@mycomp.com",

deptnum: "mkt1234" },

ITSupport:{ contact: "Goah Wei",

email: "it@mycomp.com",

deptnum: "its1234" }};

function SetFieldValues(cDeptName)

{

this.getField("DeptContact").value = DeptData[cDeptName].contact;

this.getField("DeptEmail").value = DeptData[cDeptName].email;

this.getField("DeptNumber").value = DeptData[cDeptName].deptnum;

}

 

 

and here is one of my scary reimaginings:

SetFieldValues

 

//Put it all in here

var ItemData = { 321-321, 321-432:{ Description0: "hard",

Price0: "61.25" },

123-123, 123-234:{ Description: "soft",

                              Price: "95" }};

function SetFieldValues(cItem0)

{

this.getField("Description0").value = ItemData[cItem0].Description0;

this.getField("Price0").value = ItemData[cItem0].Price0;

}

 

gets me syntax error. I take out the - in the item number it seems to move beyond, but then app crashes. /shrug. I'm very curious about the proper method to list Lots of item numbers in a SetFieldValues situation??

 

I've got 10 rows in the columns and figured each row is going to need it's own setfieldvalues pertaining to the name of the cells in the row. From top down, Item0, Item1, Item2, etc. (Description0 & Price0 too). Thank you!


Viewing all articles
Browse latest Browse all 73766

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>