JIRA Help icon - custom fields

Karthick Sambasivam September 13, 2014

Hi,
We would like to have help icon for some custom fields. When I define the below code for 2 custom fields, I am seeing help icons for the 2 custom fields but when I click on help icons, it always opens the first value (3 - High, 2 - Medium, 1 - Low)  which is in code 1 as below. I would like to see (3 - High, 2 - Medium, 1 - Low) when I click on help icon code 1 custom field and (3 - Sev1, 2 - Sev2, 1 - Sev3) when i click on help icon code 2 custom field.

 

Code 1:
<script type="text/javascript">
function showHelp() {
var helpDiv = AJS.$("#ProbabilityFieldHelp");
if (helpDiv.length == 1) {
helpDiv = helpDiv[0];
if (helpDiv.style.display == 'none')

{ helpDiv.style.display = ''; } else { helpDiv.style.display='none'; }
}
}
</script>

<a href="#" title="Click '?' for help" onclick="showHelp(); return false;"><img src="/images/icons/ico_help.png"/></a>

<div id="ProbabilityFieldHelp" style="display:none">
3 - High</br>
2 - Medium</br>
1 - Low</br>
</div>

Code 2:
<script type="text/javascript">
function showHelp() {
var helpDiv = AJS.$("#ImpactFieldHelp");
if (helpDiv.length == 1) {
helpDiv = helpDiv[0];
if (helpDiv.style.display == 'none') { helpDiv.style.display = ''; }

else

{ helpDiv.style.display='none'; }

}
}
</script>

<a href="#" title="Click '?' for help" onclick="showHelp(); return false;"><img src="/images/icons/ico_help.png"/></a>

<div id="ImpactFieldHelp" style="display:none">
3 - Sev1</br>
2 - Sev2</br>
1 - Sev3</br>
</div>

3 answers

1 accepted

2 votes
Answer accepted
Tim Eddelbüttel
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.
September 13, 2014

Hello Karthick,

booth java script snippets using the same function, i think that is the problem. They must be unique.

Here is my example, we have two custom fields where we see contact details from an external vendor.

Contact details
&lt;script type="text/javascript"&gt;
  function showHelpCompany1() {
        var listenersDiv = document.getElementById("qaFieldHelpCompany1");
        if (listenersDiv.style.display == 'none') {
          listenersDiv.style.display = '';
        } else {
          listenersDiv.style.display='none';
        }
  }
&lt;/script&gt;
&lt;a href="#"  onclick="showHelpCompany1(); return false;"&gt;&lt;img src="/images/icons/ico_help.png"/&gt;&lt;/a&gt;
&lt;div id="qaFieldHelpCompany1" style="display:none"&gt;
Phone: +49 12 34 56 78 &lt;br&gt;
&lt;/div&gt;
Contact details
&lt;script type="text/javascript"&gt;
  function showHelpCompany2() {
        var listenersDiv = document.getElementById("qaFieldHelpCompany2");
        if (listenersDiv.style.display == 'none') {
          listenersDiv.style.display = '';
        } else {
          listenersDiv.style.display='none';
        }
  }
&lt;/script&gt;
&lt;a href="#"  onclick="showHelpCompany2(); return false;"&gt;&lt;img src="/images/icons/ico_help.png"/&gt;&lt;/a&gt;
&lt;div id="qaFieldHelpCompany2" style="display:none"&gt;
Phone: +49 12 34 56 78 &lt;br&gt;
&lt;/div&gt;

I think you see what i mean.

 

Regards,
Tim

0 votes
Sven Götz September 18, 2014

Hello Karthick, it seems that the html in the description field won't be interpreted in "User Picker (single user)". If I place a link there (like <a href="http://xxxxxxxx.com/x/ygA3" target="_blank">HG Field Description</a>) the system displays me the whole syntax.

Can you confirm this, is it a bug?

0 votes
Karthick Sambasivam September 13, 2014

Thank you so much. It works.

Suggest an answer

Log in or Sign up to answer