The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Behaviors Script to validate field drop down select options

Scott Federman
Contributor
February 8, 2021

I have a single select dropdown field called "How did you hear about AIES? I have a default option that is "Choose from the dropdown". What would the script be that will validate that this field does not have "please choose from the dropdown" selected in this field? 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
PD Sheehan
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 Champions.
February 8, 2021

Generally, I'd recommend you just remove that "choose from the dropdown" option, remove your default value and set that field as required. This will let the built-in logic take care of ensuring a field is selected.

But if you really insist on using a script runner script, you can do it with something like this:

def field = getFieldById(getFieldChanged())
field.clearError()
if(field.value == 'Choose from the dropdown'){
field.setError('Please choose from the dropdown')
}