Java scripts implemented in the field configuration->field description is not working..

Anoop Wilson
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.
April 18, 2012

Java scripts implemented in the field configuration->field description is not working..

11 answers

1 accepted

0 votes
Answer accepted
Anoop Wilson
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 9, 2012

We added the scripts as part of a plugin and worked well

2 votes
RambanamP
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.
April 23, 2012

The best way to add javascript for jira 5.0 is by using webresource

<web-resource key="test-js" name="javascript">
		<dependency>jira.webresources:global-static</dependency>
		<description>JavaScript test</description>
		<resource name="test.js" type="download" location="templates/js/test.js" />
		<context>atl.general</context>
		 <context>atl.admin</context>
	</web-resource>

test.js as follows

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {

....javascript

});

0 votes
Janice Amber July 11, 2012

Hi, by adding

window.onload = function () {window.location.reload()}

to one of the custom field description java script, this seems to have cause the custom field page to be refresh continously, and i am not able to edit any of the custom field.
I have tried to delete this from the field configuration page, but the same refresh issue is also seen in the field configuration page

Any idea/advice on how to stop this to remove the above coding from the custom field

0 votes
Anoop Wilson
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.
April 22, 2012

Hi Mizan,

This also not working..The scrips works only in the second time loding.

0 votes
Mizan
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.
April 19, 2012

This might be a browser issue , try with different browsers . You can even include the below line in your script .

window.onload = function () {window.location.reload()}

This will refresh the page and may help .

0 votes
Anoop Wilson
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.
April 19, 2012

Yes..I already tried it..If I refresh the page 2 or 3 times,the script is getting loaded..,.

Any idea about this behavior.

0 votes
Dieter
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.
April 18, 2012
Did you already place alert or console.log statements at the beginning of each event handler to see if the script is called at all?
0 votes
Anoop Wilson
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.
April 18, 2012

First part of code

<script type="text/javascript">
window.onload = function(){
requistionType = AJS.$("#customfield_11470");
capitalPlanDisplayArea=AJS.$("#cf-customfield_10741").closest('fieldset.group');
capitalPurchaseReasonDisplayArea=AJS.$("#cf-customfield_10740").closest('fieldset.group');
capitalFinancingDisplayArea=AJS.$("#cf-customfield_10739").closest('fieldset.group');
assetlifeArea=AJS.$("#customfield_11471").parent();
assetLocationArea=AJS.$("#customfield_11472").parent();
BackgroundArea=AJS.$("#customfield_10718").parent();
ProposalArea=AJS.$("#customfield_10716").parent();
capitalPlanDisplayArea.hide();
capitalPurchaseReasonDisplayArea.hide();
capitalFinancingDisplayArea.hide();
assetlifeArea.hide();
assetLocationArea.hide();
BackgroundArea.hide();
ProposalArea.hide();
rechargingtype = AJS.$('#cf-customfield_10753').parent();
capitalPlan= AJS.$('#cf-customfield_10741').parent();
capitalPurchaseReason= AJS.$('#cf-customfield_10740').parent();
capitalFinancing= AJS.$('#cf-customfield_10739').parent();
capitalPlan.hide();
capitalPurchaseReason.hide();
capitalFinancing.hide();
rechargingtype.hide();
sapcategory.hide();
sapcode.hide();
//Reactto change of Requisition Type
requistionType.change(function() {

if (requistionType.val()=="Capital Appropriation") {

capitalPlanDisplayArea.show();
capitalPurchaseReasonDisplayArea.show();
capitalFinancingDisplayArea.show();
assetlifeArea.show();
assetLocationArea.show();
BackgroundArea.show();
ProposalArea.show();

capitalPlan.hide();
capitalPurchaseReason.hide();
capitalFinancing.hide();
rechargingtype.hide();
} else {
capitalPlanDisplayArea.hide();
capitalPurchaseReasonDisplayArea.hide();
capitalFinancingDisplayArea.hide();
assetlifeArea.hide();
assetLocationArea.hide();
BackgroundArea.hide();
ProposalArea.hide();
}
});

0 votes
Anoop Wilson
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.
April 18, 2012

JIRA 5 we are using

0 votes
Anoop Wilson
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.
April 18, 2012

second part


//Reactto change of Purchasing method

purchase.change(function() {


if (purchase.val()=="SAP")
{

sapcategory.show();
sapcode.show();

} else {


sapcategory.hide();
sapcode.hide();

}

});



};
AJS.$(function () {

function initMyCustomField(dialog) {
AJS.$(dialog || document.body).each(function () {
var $dialog = AJS.$(this);

});
}
window.onload();

AJS.$(document).bind("dialogContentReady", function (e, dialog) {
window.onload(dialog.get$popupContent());
});

});
</script>

0 votes
Mizan
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.
April 18, 2012

What version of Jira ? can you paste the script here ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events