HTML instead of description box

AUser July 10, 2013

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

0 votes
Answer accepted
AUser July 16, 2013

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)

1 vote
Tom Moors
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.
July 10, 2013

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