Javascript hidden field does not hide on JIRA 5.1, but is hidden on JIRA 4.0

Ryan Aherne
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.
August 7, 2012

Javascript hidden field does not hide on JIRA 5.1, but is hidden on JIRA 4.0

Just wondering if it still should work in v5.1 i.e. I have javascript on a custom field (my javascript is in the description of the custom field), when I check the custom fields checkbox another field is displayed giving the user more options.

This works as expected in JIRA 4.0, but on my test install of 5.1.1 I see all options displayed on form load.

Maybe you can point me in the right direction, is it a config option on the new form? Any ideas why this is/would happening?

Background: I've just upgraded to v5.1.1 and migrated my v 4.0 database via an xml export/import.

Ta,

1 answer

1 accepted

1 vote
Answer accepted
Harry Chan
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.
August 26, 2012

Hi, the way events and Javascript is handled has changed since JIRA 5.x. Please refer to https://developer.atlassian.com/display/JIRADEV/Custom+Fields+that+use+CSS+or+JavaScript+Web+Resources+in+JIRA+5.0 for more information.

Harry Chan
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 2, 2012

Hi, the same applies. I gave a similiar example here for what it now should be - https://answers.atlassian.com/questions/79201/jira-5-1-2-questions-re-pop-up-issue-edit-window

Ryan Aherne
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 2, 2012

Hi Harry,

Thanks for the link, it refers to updating plugins that use customfields/JavaScript. My query was in relation to JavaScript placed in the description of a stock custom field.

Ryan Aherne
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 2, 2012

The penny drops... I see the reference to JIRA.Events.NEW_CONTENT_ADDED

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
AJS.$(".myspecialfield", context).css("background-color", "#8f8");
});
I'll give that a go and let you know how I get on , thanks Harry.
Ryan Aherne
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 14, 2012

It seems to work on issue creation, but only after the page has fully loaded, and it does not work on edit screen. It's a step in the right direction I suppose, thanks Harry.

Suggest an answer

Log in or Sign up to answer