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

If, Then

DFlamma
Registered: Oct 11 2011
Posts: 1

I just got AcrobatX Pro 10 and am getting my feet wet with the abilities of the fillable forms. I have been able to figure out basic computation and formulas but have hit a road block in being able to have a field automatically put in a number based on the response from another field. Here is what I would like to do:
 
If field 1 is a drop down box for all state abbreviations then I would like field 2 to recognize which state was selected and auto fill a number based on that state ie. if NJ is selected then field 2 will auto fill: $25,000. If NY is selected then field 2 will auto fill $50,000. Some states will have the same number associated with it so NJ, PA, DE might have $25,000 associated with it and NY, MA, RI might have $50,000 associated with it.
 
I appreciate anything that anyone can do to point me in the right direction!
  
Dan

My Product Information:
Acrobat Pro 10.0, Macintosh
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
You could set up a custom object to associate the value of each item in the combo box with a price. Field 2, which is presumable a text field, could be set up with a custom calculation script that set its value based on the value of the combo box. For example:

// Custom calculate script for Field 2
var prices = {" ": 0, "NJ": 25000, "NY": 50000, "WA": 15000, "PA": 25000, "DE": 25000, "WY": 10000, "CA": 45000, "MA": 50000};
event.value = prices[getField("STATE").value];


Replace "STATE" with the actual name of the combo box you're using. Add as many entries to the "prices" object as needed. Note the first item is a single space, which is a common thing to include in a comb box to indicate no selection, but you still need to account for it.

PDFchild
Registered: Oct 31 2010
Posts: 44
use those prices figure on the "export value" box against each state entry. Then use a script in calculations for field 2 to "get" the value from the combo box.

Calculation Script: event.value = this.getField("STATE").value;


Set field format to Number > Currency in $.Hope this helps.

PDFchild [at] gmail [dot] com - Go Green Save Paper Adopt a PDF

PDFchild
Registered: Oct 31 2010
Posts: 44
BTW "STATE" is the name we have assumed for the field which is the drop down or combo box for abbreviated state names

PDFchild [at] gmail [dot] com - Go Green Save Paper Adopt a PDF

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
The drop down box is easier to maintain by using a document level function to load the combo box from a document data object or an array using the "setItems" method in a document level script or function. One need only update the items in the array or object and then save the PDF.

It is easier to change the value in an array element than to delete and reenter the Item and Export value on the field UI.

George Kaiser