Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Hide custom field based on another custom text field?

Tim Perrault February 2, 2018

I want to hide a custom field if there is nothing in another custom field that is a Text Field (multi-line).

I am trying to use the behaviour plugin, but can't figure out how to check if a text field is empty.

How would I validate against the Text Field to see if it is empty?

1 answer

1 accepted

0 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 2, 2018

You script would look like this

 

def multiLineField = getFieldById(getFieldChanged())
def fieldToHide = getFieldByName("field to hide name")
if (multiLineField.getValue() && !multiLineField.getValue().toString().isEmpty()) {
    fieldToHide.setHidden(true)
}
else {
    fieldToHide.setHidden(false)
}
Tim Perrault February 5, 2018

Thank you! This got me on the right track. 

I changed this line:

(multiLineField.getValue() && !multiLineField.getValue().toString().isEmpty())

 To

(multiLineField.getValue().toString().isEmpty())

Suggest an answer

Log in or Sign up to answer