Issue with Javascript in the description field of a custom field

DeepakBhatia January 21, 2013

Hi,

https://confluence.atlassian.com/display/JIRA/Displaying+a+Field+Based+on+Another+Field+Selection

I am using above link to manipulate the value of the custom field based on some other custom field values in the javascript code. The problem I am facing is that once I open a screen where the below custom field is shown, it doesn't take the formula below. But once I open the screen again, it takes the formula below.

Please help me in resolving this.

Regards

Deepak Bhatia

============================================================================

if(document.getElementById('customfield_10163').options[document.getElementById('customfield_10163').selectedIndex].text == "None")
{
val10163=0;
}
else
{
val10163=parseInt(document.getElementById('customfield_10163').options[document.getElementById('customfield_10163').selectedIndex].text);
}

if(document.getElementById('customfield_10164').options[document.getElementById('customfield_10164').selectedIndex].text == "None")
{
val10164=0;
}
else
{
val10164=parseInt(document.getElementById('customfield_10164').options[document.getElementById('customfield_10164').selectedIndex].text);
}

if(document.getElementById('customfield_10165').options[document.getElementById('customfield_10165').selectedIndex].text == "None")
{
val10165=0;
}
else
{
val10165=parseInt(document.getElementById('customfield_10165').options[document.getElementById('customfield_10165').selectedIndex].text);
}

if(document.getElementById('customfield_10166').options[document.getElementById('customfield_10166').selectedIndex].text == "None")
{
val10166=0;
}
else
{
val10166=parseInt(document.getElementById('customfield_10166').options[document.getElementById('customfield_10166').selectedIndex].text);
}

if(document.getElementById('customfield_10162').options[document.getElementById('customfield_10162').selectedIndex].text == "None")
{
val10162=0;
}
else
{
val10162=parseFloat(document.getElementById('customfield_10162').options[document.getElementById('customfield_10162').selectedIndex].text);
}

finalvalue = ((val10163+val10164+val10165+val10166)/4)*val10162;

document.getElementById('customfield_14661').value=finalvalue.toFixed(1);

3 answers

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.
January 21, 2013

AFAIK it is available . you will need to check if you need to disable inline editing / it will automatically disable for these fields only .

0 votes
DeepakBhatia January 21, 2013

Thanks but I think it is not available for JIRA 5.1.6.

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.
January 21, 2013

You can also use behaviours plugin for this ... See this similar example

Suggest an answer

Log in or Sign up to answer