How to get dependent dropdown to work with two words

I have Pro XI and currently use a script for dependent dropdowns that works fine...unless one of the options is two words..such as Chrysler Building. An example of the issue I'm having with the script is:

From the document level script:
myDropdownValues=["Yes", "No", "Might Be"];
this.getField("Dropdown1").setItems(myDropdownValues);
var AnswerData= { Yes: ["1", "2"],
No: ["3", "4"],
Might Be: ["5", "6"]
};
function SetFieldValues(cData)
{
this.getField("Dropdown2").setItems(AnswerData[cData]);
}

Yes and No work as expected, when I select those, the cascading options work, but Might Be causes an error message that won't clear unless I take the space between the words out. However since MightBe is not one of the Dropdown1 options, the cascading doesn't work. Might Be shows up in Dropdown1, but since the doc level script says MightBe, the cascading doesn't work for that options. The space between that word seems to be the problem. Do all cascading options have to be one word?


DHHS CDC


2 Answers

Voted Best Answer

Put quotes around the texts, so:

var AnswerData =  { 
    "Yes": ["1", "2"],
    "No": ["3", "4"],
    "Might Be": ["5", "6"]
};

.


Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com


By Gilad D (try67)   

There seems to be some code missing: You define a function SetFieldValues, but this function does not get called in that snippet that you've posted.

What is the error you are getting (please quote exactly)?


Karl Heinz Kremer   


Please specify a reason: