How can I add default text to description field?

Nariman Riahi October 11, 2011

I like to put defaults text in the description field:

for example:

******************

Steps to reproduce:

Expected results:

Actual results:

*****************

Is there a way to do that?

Thanks

5 answers

1 accepted

1 vote
Answer accepted
Sean Rich October 12, 2011

Go to the particular Field Configuration and find the Description field. Click "Edit" and in the description for this field add text similar to the following:

<script type="text/javascript">
if (document.getElementById("description").value == "") {
document.getElementById("description").value = "*Steps to Reproduce* \n\n\n\n*Expected Results* \n\n\n\n*Actual Results* \n";
}
</script>

Nariman Riahi October 12, 2011

I will give this a shot today. Thanks

Nariman Riahi October 26, 2011

This fixed my problem. THanks to everyone who suggested. I decided to stay away from editing the vm file.

Dnyaneshwar Ramesh Borase March 11, 2019

Hello Sean,

 

I tried the same as you suggested, but unable to view default text in the description field.

 

Is there any requirement of add-on?  Please let me know how to add those text?

 

Thanks!

0 votes
Shamith K S October 19, 2011

write this in body of .vm file.

#set($description="yourcontent")

or if u want new line charactersand all,

use this

AJS.toInit(function () {

AJS.$("#description").text(" steps to produce \r \r expedted results \r \r")});

0 votes
Henry Armburg Jennings October 12, 2011

in which case, perhaps edit the .vm file associated with a particular field type?

the edit-xxxxx .vm files are found here on my computer: C:\Program Files\Atlassian\JIRA 4.3.4\atlassian-jira\WEB-INF\classes\templates\plugins\fields\edit

0 votes
Henry Armburg Jennings October 11, 2011

Is this for a custom field you are creating? What is the context? You can edit this sort of thing in the .vm file. I have just created a custom field and have specified name, default values etc so I would assume you could do the same for the description field.

Nariman Riahi October 12, 2011

I just want to add the stuff I mentioned previously.

I want the description field to show this text in it.

Steps to reproduce:

Expected results:

Actual results:

0 votes
Jobin Kuruvilla [Adaptavist]
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.
October 11, 2011

You cannot give default text without populating it using Javascript or something. Using Javascript maybe an idea though!.

Another option is to use a description (by editing the description field in the field configuration) that asks the user to enter ther description in the said format.

Suggest an answer

Log in or Sign up to answer