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

more on automatic content based on choice of a previous Combo Box

Genie001
Registered: May 19 2010
Posts: 10
Answered

I have a form with a table containing a combo box (ClassCode1) and a text field (DescriptionRow1) I want to auto populate. The combo box’s properties/options have the numerical values entered. The text field properties/calculate radio is set to custom calculation script and contains the script:

// using the 'combo box1' field value:
switch(this.getField('ClassCode1').value) {
case '42' :
event.value = Landscape; // 'EB' choice
break;
case '3724' :
event.value = Millwright; // 'TT' choice
break;
case '5020' : // 'EB-SS' choice
event.value = Acoustical_Ceiling;
break;
}

When I save the form and go to preview, I can select the combo box property, but nothing shows up in the text field. Am I missing a step somewhere?

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Are the values of the export option numbers as text strings or numbers?

Are the items you are trying to set the text field to variable names, field names, or text strings?

Quotation marks are used to identify text strings and not numbers. Text strings need to enclosed in quotation marks.

// using the 'combo box1' field value:switch(this.getField('ClassCode1').value) {case 42 :event.value = 'Landscape'; // 'EB' choicebreak;case 3724 :event.value = 'Millwright'; // 'TT' choice break;case 5020 : // 'EB-SS' choiceevent.value = 'Acoustical Ceiling';break;}

I would set the optional export value in the combo box and then I would only need to get the value of the combo box. You could also initialize the combo box with an document level script so updating the combo box's option and export value is done by editing an array variable.

George Kaiser

Genie001
Registered: May 19 2010
Posts: 10
Thank you, your corrections of whatever syntax error I had entered worked.

To answer your following questions:

The values of the export options are set to numbers in the options tab.

The values of the text field are strings.

I had already set the optional export value in the combo box to match numerically.

I also want to add a case value that allows the end user to type in a custom(text string) event.value. I have tried;

case 01 :
event.value = ' '; // = 'space' and it creates a void, but changes to blank on out of focus
break;
case 42 :
event.value = 'Landscape'; // and so on.

I cannot locate a custom text attribute as in what the combo box will allow. Is it possible to add 'null' or something else that will allow this?

tx, Genie
gunnycc
Registered: Aug 17 2009
Posts: 1
Hi I am a newbie and I haven't been able to find the answer to the following question:
I have a Combo Box with 3 options:
Refund to Tenant
Due From Tenant
No Refund

I would like the answer automatically be choosen from a calculated field in the same document ( I did this in Access but don't know how in Acrobat 9). I would assume that the answer would be a java script (perhaps a switch command) that involves:

> 0 (This would be "Refund To Tenant")= 0 (This would be "No Refund")

< 0 (This would be "Due From Tenant")I have tried searching the internet into 1:30 am and can't find the solution.

Thank you for your time!
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Why even use a combo box. You can use a text box that is populated from the field that calculates the balance due and inserts the appropriate text. You could use the following script in the 'custom validation script' on the 'Validation tab'.
// variable for message text box namevar cMessage = "MessageTextField";// do not edit any code blow// clear field to default valuethis.getField(cMessage).value = "";if(event.value < 0)this.getField(cMessage).value = "Due from Tenant";if(event.value == 0)this.getField(cMessage).value = "No Refund";if(event.value > 0)this.getField(cMessage).value = "Refund to Tenant";

George Kaiser