How do I add an inline text for a custom field in JIRA?

Shahriar August 29, 2018

Hello, 

I am wondering if there is a way to add an inline text for a custom field (single line or multi line) in JIRA? Once the user clicks inside the field or starts typing, the inline text should disappear. Note, I don't want that inline text to be considered as an existing value. What I mean is that if the user doesn't enter anything in that field and if I have a field required validation, I would like the validation to work regardless of that inline text. I am sorry if that is confusing.

I am guessing I have to add some script to the custom field description but I don't know how to write up the code. Please help! 

 

Thanks, 

Shahriar

2 answers

1 accepted

1 vote
Answer accepted
Mauricio Karas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 31, 2018

Hello, Shahriar.

I believe you're talking about adding a placeholder in the field.

You can do this with a "Hideable Free Text Field (unlimited text)" field type.

Create the custom field with that type and then you can add the following into the description field:

<script type="text/javascript">
document.getElementsByName('customfield_10700')[0].placeholder='This will appear as a placeholder';
</script>

Keep in mind to add the code in the right description, go in the custom field page, click in the Cog icon on the right, then in Edit.

Also, to get the field's ID to put in the "getElementsByName" function, check the URL in the edit page itself:

http://localhost:8080/secure/admin/EditCustomField!default.jspa?id=10700

In this case, the element name should be "customfield_10700".

Kind regards,
Maurício Karas

Shahriar Kabir August 31, 2018

Hi Maurício, 

Thank you, Sir! You are a genius. It worked beautifully! Thank you so much for your help. 

 

Thanks, 

Shahriar 

Nigel Mahoney November 4, 2019

I tried this and while it did add a placeholder I found that when I went to the Custom Field page (the one with the list of custom fields on), this page with this field would not load. I suspect it is because the description is now read only and a javascript error is being generated.

Is this the case for everyone or have I missed something?

Thomas Howard August 17, 2020

@Nigel Mahoney  I have the same problem as mentioned and can no longer edit the field unless I type the URL to edit that custom field.

Like Steven Carmean likes this
Steven Carmean September 14, 2020

This is now the same for us. I work with Shahriar and we upgraded from 8.5.5 to 8.11.1 and now we lost the ability to make edits directly from the issue.

0 votes
Sebastian Gomez June 24, 2019

@Mauricio Karas Thank you, your solution worked perfectly! 

Suggest an answer

Log in or Sign up to answer