How can I set the size of custom field "Text Field" from javascript in jira?

Can I set the size of custom field "Text Field (< 255 characters)" to 50 Chars from javascript in jira?

4 answers

1 accepted

This widget could not be displayed.

In the field description, add this

<script type="text/javascript">

document.getElementById("customfield_xxxxxx").maxLength=50;

</script>

where
customfield_xxxxxx is the id of your
Text Field

When I try the code above nothing happens. Only difference is I'm checking a field length of 5.

I guess I'll try a Script Runner transition, but why doesn't the javascript fire?

If I put an alert in the javascript, an alert pops up on the screen right when I hit save. Why would that happen, I haven't entered and data yet!

This widget could not be displayed.

Or simply add a validator using Script Runner, rather than doing it in javascript (which can break anytime, and it is just a client side validation)

Thanks!

But, how can i achieve that? I need complete guide to that.

This widget could not be displayed.

In the field description, add this

<script type="text/javascript">

document.getElementById("customfield_xxxxxx").maxLength=50;

</script>

where
customfield_xxxxxx is the id of your
Text Field

This widget could not be displayed.

Hi,

I have a similar requirement that, i have to set the width of the customefield(Number field). But, using the above javascript in the field description does not serve the purpose.

Please help with the same

Regards,

Akshatha

That's work fine for me in v5.1 jira.

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 Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

575 views 25 15
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