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

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 


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?


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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in United States

Administrators Cleanup

Good morning, After a long weekend cleaning up, I am still in the cleanup mode 😊. I am curious to know: When do you feel the urgency to cleanup your Atlassian Tools? How many times do y...

23 views 0 0
View post

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