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

Can we set default text to custom fields(Free text Field) in jira 5 ?

Ramesh Udari1 May 26, 2015

Hi,

 

We want to set some default text to custom field on issue creation page, as soon as user click on custom field input box default value should be clear and user has to enter new value. Is it possible with javascript/jquery?. If yes kindly provide some help on it with sample code.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2015

Hi Jonson!


Sure you can. Please see here: https://confluence.atlassian.com/display/JIRA/Configuring+a+Custom+Field#ConfiguringaCustomField-default_valueDefaultvalue

========

If you need the suggestion text that disappears when you start typing, you can try to inject  placeholder attribute via jQuery. Please add following JavaScript to the Description of your custom field:

$document.ready(function() {
  $("YOUR-SELCTOR").attr("placeholder", "Type here to search");
});

Instructions how to do it: https://confluence.atlassian.com/display/JIRAKB/How+to+display+a+Field+based+on+another+Field%27s+selection

Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2015

I was thinking the same, but the tricky part is to clear the field as soon as you click in that field. I have no solution for that and I'm curious if there is!

Ramesh Udari1 May 26, 2015

Hi Volodymyr, You are suggestion is valid, but it does not work as we expected. If we set default value for field as you suggested above, it set value for field permanently. This is we are not looking. We are looking for suggestion predefined text in custom fields and when user click in that field we would like to cleat that text and if not we have not set any value in that custom field. For example, please refer below example. Same we are expecting in JIRA. Is it possible. http://www.dailycoding.com/Uploads/2008/08/DefaultTextSample.htm

Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2015

Jonson, please see updated answer.

Ramesh Udari1 May 27, 2015

Thanks for quick response on it Volodymyr. I have few queries on above java script: $document.ready(function() { $("YOUR-SELCTOR").attr("placeholder", "Type here to search"); }); Here , YOUR-SELCTOR -------------> is my custom field name. But what is the "place holder" attribure here ?

Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2015

YOUR-SELCTOR is jQuery selector: https://api.jquery.com/category/selectors/ "placeholder" is HTML attribute so do not touch it: http://www.w3schools.com/tags/att_input_placeholder.asp

Jen Adel August 1, 2018

Tried to do as mentioned above but the description text appears with the jQuery supplied instead of the text alone appearing within the custom field text box which should disappear on clicking the field.

Eg:  A custom field 'Sponsors' was added with the description text as below:

jQuery for Custom Field Description.PNG

Once the field was added to the JIRA issue, the Description text appears as below:

Description Text.PNG

Could we get the description text to appear within the 'Sponsors' field and to disappear when we click on this field?

Mark Boyes October 25, 2018

I'm seeing the same problem as Jen: the "Edit Custom Field Details" form does exactly what is says it does: display what's entered underneath the field, verbatim.

Has the the support for customising the text using jQuery deteriorated since 2015 (when the question was raised)? The suggested solution has an element of XSS attack about it, so i would not be surprised that a general improvement in security stopped the solution from working.

TAGS
AUG Leaders

Atlassian Community Events