Issue with Javascript in the description field of a custom field

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

This widget could not be displayed.
Mizan Community Champion Jan 21, 2013

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

This widget could not be displayed.

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

This widget could not be displayed.
Mizan Community Champion Jan 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 .

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

63 views 1 0
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