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

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

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.

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

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.

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.

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

714 views 1 18
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