Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

In JIRA 5.0 Javascript onchange embedded no longer works if you change issue type or project

Dana Frost
Contributor
April 12, 2012

Here is an example of some Javascript that works well in JIRA 4.x but no longer works in 5.x when you create issues due to the changes in way the create (type/project) changing works. The Javascript seems to work UNTIL you change the project or type then it no longer appers to fire. Its strange because it will work if you don't change the project/type or if you open the "Create" window in a new tab but not if the default sub-window is used (with the project/type change at the top).

EXAMPLE of an onchange javascript hook that no longer words in JIRA 5.0

<script type="text/javascript" charset="utf-8" id="setCandidateRelnote">
document.getElementById("customfield_10403").onchange = function() {
if ( document.getElementById("customfield_10403").selectedIndex == 2 ||
     document.getElementById("customfield_10403").selectedIndex == 3 ||
     document.getElementById("customfield_10403").selectedIndex == 5 ||
     document.getElementById("customfield_10403").selectedIndex == 6) {
     document.getElementById("customfield_10306-1").checked = true;
    }
}
</script>

1 answer

1 accepted

1 vote
Answer accepted
JamieA
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 12, 2012

Same as the other question, answer is in https://developer.atlassian.com/display/JIRADEV/Custom+Fields+that+use+CSS+or+JavaScript+Web+Resources+in+JIRA+5.0.

Use a live() handler for "change" or bind to JIRA.Events.NEW_CONTENT_ADDED.

Dana Frost
Contributor
April 12, 2012

Thanks. I found that page after some more searching. Seems like I have a bit of work to do :)

https://developer.atlassian.com/display/JIRADEV/Custom+Fields+that+use+CSS+or+JavaScript+Web+Resources+in+JIRA+5.0

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events