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

Field Selection of two possible choices

Bill1234
Registered: Feb 8 2009
Posts: 10
Answered

I have a volume field that I need to have select the appropriate volume of solution based on another fields calculation (ie, based on BSA calculated, the volume field would select from two possible choices - for a BSA equal to or less than 0.6 m2 return 250 mL; if greater than 0.6 m2 return 500 mL).

My Product Information:
Acrobat Pro 9.0, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
It's not entirely clear to me what you want to do, but try the following code as the custom calculation script for the volume field:

(function () { // Get the value of the BSA calculated field, which is assumed to be a numbervar BSA_calc = +getField("BSA_calculated").value; // Set this field value based on the value of BSA_calcevent.value = (BSA_calc > 0.6) ? 500 : 250; })();

Replace "BSA_calculated" in the code above with the name of the field you're using.

George
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Sounds like you need a JavaScript calculation for this "volume" field. The exact syntax of the calculation depends on forms technology. Is this an AcroForm or a LiveCycle form?

Here's what the AcroForm solution should look like. The LC solutions is slightly different.

var nBSA = this.getField("BSACalcField").value;
if(nBSA < .6)
event.value = 250;
else
event.value = 500;

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script