Yes you could. But if you are going that route, I would advise to do the following, in order to simplify the code afterwards: -Instead of putting the code in each button with a slight variation, put your code inside a document-level function and call it from the button. That way, you type it only once and in the event you need to change part of it, it becomes much easier to do so //at document-level function manProdColor(){ //put your code here } //and you call it from the action of the button manProdColor() -Since you need to output 2 values from the buttons, the manufacturer and the product selected, I suggest using export values that contain both information such as "Certain Teed.Landmark" , "Certain Teed.Landmark Premium" , etc. By doing so, you will later be able to use the split() method of the String object to remove the "." and separate both values to export it in according fields function manProdColor(){ var myValue = event.value //assign the String "Certain Teed.Landmark" to myValue var aMyValue = myValue.split(".") //Creates an array of Strings ["Certain Teed", "Landmark"] var manufacturer = aMyValue[0] //Isolate the Strings var product = aMyValue[1] //Isolate the Strings this.getField("manufacturer").value = manufacturer this.getField("product").value = product } -Since you have about thirty different products with 30 different color profiles (althought some might be the same), you could use a switch to handle the setItems() method or simple if statements. If more than one product share the same color profile, instead of using if()&&()&&()&&() which becomes rapidly unreadable, place all those product in an array and use the indexOf() method of the array object to determine if product reside in one group or another. indexOf() returns the 0-based position of a value inside an array. If the value is not in the array, it returns -1. function manProdColor(){ var myValue = event.value //assign the String "Certain Teed.Landmark" to myValue var aMyValue = myValue.split(".") //Creates an array of Strings ["Certain Teed", "Landmark"] var manufacturer = aMyValue[0] //Isolate the Strings var product = aMyValue[1] //Isolate the Strings this.getField("manufacturer").value = manufacturer this.getField("product").value = product var prodGroup1 = ["Landmark", "Landmark Premium"] var profile1 = [" ","Black","Red","Blue"] var prodGroup2 = ["Landmark PRO", "Landmark TL"] var profile2 = [" ","Yellow","Green"] if (prodGroup1.indexOf(product) != -1) this.getField("profile color").setItems(profile1) if (prodGroup2.indexOf(product) != -1) this.getField("profile color").setItems(profile2) }
... View more