HTML instead of description box

Hi,

today I started my instance of JIRA 6.

In the create dialog there is now HTML displayed instead of a real textbox. I added a picture of the displayed result.

When I display the HTML source code I see that the tags (< and >) have the false markup (&lt; and &gt;). Of course the browser is now ignoring this tags. But the question is why this is so. I edited the description template (description-edit.vm).
Between "$!rendererParams.put("wrap", "virtual")" and "#if ($mentionable)" I added this:

#if($description == '')
#set ($description = "*Initial behaviour:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------\
\
*Real behaviour:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------\
\
*Expected behaviour:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------\
\
*Comment:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------")
#set ($description = $description.replace('\',' '))
#end


Full fill: http://pastebin.com/cK4bMsv6

The line endings are marked as \n like the oroginal file. No other changes are made of any JIRA file. As the renderer the wiki renderer is set which is also activated.

Does anybody know how to solve this?
Tanks in advance!


2 answers

1 accepted

Accepted Answer
0 votes

The answer was in the first line!

If you have a look at the Link to pastebin you can see that the line #disable_html_escaping() was changed to ##disable_html_escaping() TODO REENABLE.

This line was commented and - of course - not executed. That means: HTML escaping was turned on. And I feel a little bit dumb because I added a remark to reenable that. Well, I think the weekend was not very good for my memory :-D

The custom fields were a good answer, but we don't need that feature.

Additionally I want to provide this Link for you (in german) where the use of $issue in combination of Apache velocity with the JIRA template is described. Unfortunatly there was no documentation about that but I'm not sure if it belongs to JIRA or Apache velocity documentation.

Here is my full template. The goal was to provide two differen templates when an issue is created. When changed to "Feature Request" the other template should be shown. If an issue already existed the description should not be overwritten.

#disable_html_escaping()
#customControlHeader ($action $field.id $i18n.getText($field.nameKey) $fieldLayoutItem.required $displayParameters $auiparams)
## setup some additional parameters
$!rendererParams.put("class", "long-field")
$!rendererParams.put("rows", "12")
$!rendererParams.put("wrap", "virtual")


#if(!$issue.isCreated())
#set ($description = "*Initial behaviour:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------\
\
*Real behaviour:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------\
\
*Expected behaviour:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------\
\
*Comment:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------")
#set ($description = $description.replace('\',' '))

#if ($issue.getIssueTypeObject().getName().equals("Feature Request"))

#set ($description = "*Goal:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------\
\
*Current situation/purpose:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------\
\
*Assumptions changes/ToDo's:*\
--------------------------------------------------------------\
\
--------------------------------------------------------------")

#set ($description = $description.replace('\',' '))

#end

#end


#if ($mentionable)
    $!rendererParams.put("mentionable", true)
    #if ($issue.project.key &amp;&amp; $issue.project.key != "")
        $!rendererParams.put("data-projectkey", "$!issue.project.key")
    #end
    #if ($issue.key &amp;&amp; $issue.key != "")
        $!rendererParams.put("data-issuekey", "$!issue.key")
    #end
#end
## let the renderer display the edit component
$rendererDescriptor.getEditVM($!description, $!issue.key, $!fieldLayoutItem.rendererType, $!field.id, $field.name, $rendererParams, false)
#customControlFooter ($action $field.id $fieldLayoutItem.getFieldDescription() $displayParameters $auiparams)

Hi AUser, welcome to Atlassian Answers!

I recommend reverting the changes to the template and using a different approach for solving your problem:

* Create new custom fields for Initial behaviour, Real behaviour, Expected behaviour. This way you have separate fields that you can make required, search on, etc. (More information on adding custom fields: https://confluence.atlassian.com/display/JIRA/Adding+a+Custom+Field)

* Add the placeholder text by using Javascript in the description of the custom field, eg:

&lt;script&gt;
if (AJS.$("#description-wiki-edit textarea").text() === "") {
  AJS.$("#description-wiki-edit textarea").text("Initial Behaviour \n etc etc");
}
&lt;/script&gt;

These solutions are less likely to break your instance, especially when upgrading :-)

Cheers,

Tom


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

22,502 views 2 7
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