I have a radio button with value yes, no, two multiline text field A, B. Wonder if I can following:
If radio button value == Yes
A enabled, B will be disabled
If radio button value == No
A disabled, B will be enabled
I am doing this in behavior script
You can do something like this:
def radio = getFieldById(getFieldChanged())
def fieldA = getFieldByName("FieldA")
def fieldB = getFieldByName("FieldB")
def selected = radio.getValue() as String
if(selected == null) {
fieldA.setFormValue(null)
fieldA.setHidden(true)
fieldB.setFormValue(null)
fieldB.setHidden(true)
}
if(selected == "A"){
fieldB.setFormValue(null)
fieldB.setHidden(true)
fieldA.setHidden(false)
}
if(selected == "B"){
fieldA.setFormValue(null)
fieldA.setHidden(true)
fieldB.setHidden(false)
}
This will need to be set up on your radio button field. It currently is set up to disable (set hidden and set to null) both fields if 'None' is selected. You can change this by modifying the first 'if' if you'd like. If you need help with this or anything else, let me know. :)
Regards,
Jenna
This was very helpful! Thank you @Jenna Davis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How can we disable particular custom field instead of hiding that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.