Hello,
I am trying to use a ScriptRunner behavior in order to hide an open text field, upon selecting various options from a single select list. Each option that you select gives a new single select list. The code that I am using is below. While the new single select list does show upon selection, the field that i want hidden remains visible. It worked fine when i only had the behaviour set on one option, but when I added the other options, it got wonky. This is my first go at this, and any help is greatly appreciated!
def 1stField = getFieldByName("Region") -- Single Select Field w/options
def 2ndField = getFieldByName("Market") -- Open Text Field I want hidden
def OptionAField = getFieldByName("OptionA")
def OptionBField = getFieldByName("OptionB")
def OptionCField = getFieldByName("OptionC")
def OptionDField = getFieldByName("OptionD")
def 1stField = 1stField.getValue() as String
if (1stField== "OptionA") {
OptionAField.setHidden(false)
2ndField.setHidden(true)
}
else {
OptionAField.setHidden(true)
2ndField.setHidden(false)
}
if (1stField == "OptionB") {
OptionBField.setHidden(false)
2ndField.setHidden(true)
}
else {
OptionBField.setHidden(true)
2ndField.setHidden(false)
}
if (1stField == "OptionC") {
OptionCField.setHidden(false)
2ndField.setHidden(true)
}
else {
OptionCField.setHidden(true)
2ndField.setHidden(false)
}
if (1stField== "OptionD") {
OptionDField.setHidden(false)
2ndField.setHidden(true)
}
else {
OptionDField.setHidden(true)
2ndField.setHidden(false)
}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.