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

Changing a text value based on a drop down in Acrobat

bschweitzer
Registered: Dec 15 2011
Posts: 3
Answered

I'm sorry if this has been discussed before but I'm new and have tried searching but all of the results I find are in the LiveCycle forum and I have Acrobat Pro.
 
I want to simply change a text field based on a drop down. This sample code was suggested in the LiveCycle forum, but doesn't work in my change action tab. Can it be modified to work in Acrobat? If so, how?
 
My text field that I want to set is called TextField1. The following code is in the selection change script for my drop-down list. The drop down has exported values of 24 or 36.
 
Thanks very much for any help.
 
Beth
  
var sNewSel = this.boundItem(xfa.event.newText);
 
switch (sNewSel)
 
{
 
case "24": // 24 inch fixture
 
TextField1.rawValue = "40 watts";
 
break;
   
case "36": // inch fixture
 
TextField1.rawValue = "60 watts"
 
break;
   
default: // unknown value -- do nothing
 
break;
 
}

My Product Information:
Acrobat Pro 9.4, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
Set the export value of each item in the drop-down as the text that you want to show in the text field, and then enter this as the text field's custom calculation script (of course, you might need to adjust the name of the drop-down to match the file in your file):

event.value = getField("DropDown1").value;

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

bschweitzer
Registered: Dec 15 2011
Posts: 3
Thanks try67 - is there some place where I can find documentation on things like event.value? This really helps!
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Here: http://www.adobe.com/devnet/acrobat/javascript.php

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

bschweitzer
Registered: Dec 15 2011
Posts: 3
Yes! Thank you very much - that is exactly what I needed.