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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Hello,

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">
document.getElementById("customfield_16604").maxLength=8;
});
</script>

where: customfield_16604 is my field id

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

2.JPG

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).

1.JPG

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

 

Thanks in advance,

Paulina

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 

Hi

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
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you