I am trying to use the following javascript to hide the javascript custom field and later add more functionality.
The strange thing is, it seems to work, but whenever I clear the browser cache and open the create issue dialog for the first time, it is not working.
<script type="text/javascript"> jQuery(document).ready(function($) { hideFields(); JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { hideFields(); }); function hideFields() { // Hide 'JavaScript' field jQuery("#customfield_10201").closest('div.field-group').hide(); } }); </script>
I have read almost every single thread about the topic here on answers.atlassian.com but I cannot figure it out.
Community moderators have prevented the ability to post new answers.
You either have to write your own web resource (plugin) or use the Live Fields functionality of the JJUPIN plugin from Kepler ROMInfo.
Do we have to restart JIRA after adding javascript for custom field configuration?
I have added js for making a multi select custom field auto render. It is not working if I check in Search for that field after adding the javascript. Please guide. I have just started with JIRA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No you don't have to restart
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have the same issue
when I change the issuetype (so I change the fieldconfiguration because the other issuetype has another configuration) the javascript doesn t work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you need to load your javascript in a plugin as webresource module, check this
https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
check the following post
https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The way Javascript is handled has changed in JIRA 5.x and hence the new events you have to listen to. Please put the javascript in the required places. As you said this is working.
It's not that Jamie doesn't meantime his plugins. He just has an issue with JIRA 5.1 and inline editing vs the behaviour plugin. That is all.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was actually talking about ScriptRunner not the Behaviors plugin. People keep filing bug reports, but he does not seem to have the time to reply.
Regarding this issue, but where should I put it? The javascript I put in the description field no longer gets executed for the current issue type, but for the next one I choose.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I really don't want to use another plugin for this and Jamie seems to be quite busy at the moment and does not maintain his plugins as well as he did in the past.
I would really prefer to figure out why this worked on JIRA 4.4.5 but is no longer working for JIRA 5.x
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, that's correct. Since you put it in the field configuration, it is part of the field configuration scheme. This is per issue type / project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But the actual problem here is, that the code does not work if the preselected issue type is not setting binding the event JIRA.Events.NEW_CONTENT_ADDED.
We have 10 different issue types, but I only need to use it for 4, that means I have to configure it for all or for none =(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I might have found the cause here:
If the preselected issue type does not have the javascript associated, then the whole thing does not work because the code never gets executed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can add it globally instead in the description of the custom field and not in the field configuration. Not sure if it'd be desired though as that would apply for everything.
The other idea is that the behaviour plugin does this out of the box.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Simply put this in every description within a field configuration that needs this? You can create separate field configurations and map it to different issue types.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How can I make it run the javascript for all issue types but have separate actions per issue type? I don't want to write a plugin. Would a combination of announcement banner and field configurations do?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, jQuery doesn't exist. Atlassian doesn't allow it. What I do is call AJS.$ instead. You need to prefix the jQuery calls with AJS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's not it. jQuery works just fine for me, but even with the following modifications you suggested it is still the same. When I first open the dialog, the field is rendered. If I close it and open it again then it disappears.
<script type="text/javascript"> AJS.$(document).ready(function($) { runJS(); JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { runJS(); }); function runJS() { // Hide 'JavaScript' field AJS.$("#customfield_10201").closest('div.field-group').hide(); } }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's AJS.$(function($) {...
I would check in Firebug or Chrome or any other developer tool you are using to see what Javascript error appears.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.