How to limit length of text field using javascript (while changing value of it on issue view screen)?


I have such problem - I need to have text field which can be only 8 characters long (it cannot be mandatory and need to be editable).

I added to "create" transition a scripted validator which checks if this field is 8 signs long, but the problem appeared here - during issue creation sometimes user do not know what she/he should put there, so this field cannot be mandatory during issue creation - it needs to be editable -> so I changed my validator to check if field is empty, if not empty if it has 8 characters (this is working perfectly good).

So this field needs to be editable -> I found such javascript (added it to field description):

<script type="text/javascript">

where: customfield_16604 is my field id

It works good while using edit screen of issue (screen below):


But if this field is added to edit screen it also can be edited form view of issue and here javascript does not work at all (field could have more than 8 signs and can be saved - screen below).


Do you have any idea what should I do to resolve it?


Thanks in advance,


3 answers

This widget could not be displayed.

I'm not sure what Javascript/jQuery JIRA is using for the in-line editing of the custom fields. But my best guess i you will have to put your codes in the same location or put a "listener" on the custom field description to listener for any "key" changes 

This widget could not be displayed.


I actually have the same problem:

  • JavaScript in Definition-Field works fine with <Edit Issue>
  • with Scriptrunner or Workflow Toolbox I can check conditions on state-transitions but

nothing works while editing a field on view screen (inline editing)

Is this problem solved?


This widget could not be displayed.

Did anyone find a resolution for this? We're having the same problem :(

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

141 views 16 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you