There is the following code that identifies the layouts in a PDF document when the values match. The problem is that only the first label will appear, in the example it has indicated two but only the first appears. In my code, about 40 if ... else syntaxes, in some I need to identify 8 Leibs at a time. I drove all the laybs into the fields array and then hide and show them in the document, depending on the user's choice in the form of a value, if the values match, then show certain laybs and hide the rest. Would be very grateful if someone suggested what is wrong with the code and how can it be changed?
var countryofgrowth = this.getField("countryofgrowth").value; var type = this.getField("type").value; var AcceptableCountries = ["Aland Islands [AX]", "Alderney", "American Samoa [AS]", "Andorra [AD]", "Anguilla [AI]", "Antarctica [AQ]", "Australia [AU]", "Belgium [BE]", "Canada [CA]", "Czech Republic [CZ]", "Denmark [DK]"]; function setDisplay(item) { var fields = ["sugarlabel", "goodsugar", "sugarQualitylevellow" /*,...*/]; for(var i=0; i< fields.length; i++){ if(fields[i] == item) { getField(fields[i]).display=display.visible; } else { getField(fields[i]).display=display.hidden; } } } if (type == "sugar" && AcceptableCountries.indexOf(countryofgrowth) != -1) { setDisplay("sugarlabel") setDisplay("goodsugar") } Something like this is my form. In each drop-down menu, the user selects values, and if certain values match, certain laybs should be seen in the document.

this.getFieldcalled in the second, justgetFieldis a different call. - Goncharov Alexanderthis.getFieldfrom the top, inside thegetFieldjustgetField: you need to make avar self = this;and inside theself.getField(...)callself.getField(...). And then, as it were, they are not asking for the code to be debugged for you - how to do this is written in the corresponding articles, and you can be asked to do it on other portals. Here they ask conceptual questions that are not available even in English. - Goncharov Alexander