Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to validate the spaces in the text filed

Hello Community,

How can i do this one with script runner or any other way. 


I have text custom field "project" and it has string limit of 16 characters or less(Done with script runner behaviors). When the user enter the input with any spaces eg: "project name" then its should throw an error for the space in the text field.

The final input should be only once character not two. eg : "projectname".

2 answers

1 accepted

0 votes
Answer accepted
Antoine Berry Community Leader May 23, 2019

Hi @niranjan ,

You can use this snippet : 

def textField = getFieldById("customfield_11000")
def textFieldValue = textField.getValue()
if (textFieldValue.contains(" ")){
textField.setError("this field can not contain spaces.")
else {


Hi @Antoine Berry  Thank you for the script. Should i use the behaviors to execute this script or any other option. 

Antoine Berry Community Leader May 24, 2019

You can save as is, the script since the getValue() method will return a string, you can use contains().

Yes behaviours is the right option, make sure you have updated the field id or use 




@Antoine Berry  Thank you its worked.

Like Antoine Berry likes this

Just adding to this, I used the script below to see if Summary field has spaces. (Summary is not a custom field and answer above was not working for me). Returns true/false for Simple Scripted Validator. Note the exclamation point in front.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.IssueTypeManager

!issue.summary.contains(" ")

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events