Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi,
I'm referring to this Q : https://answers.atlassian.com/questions/43534/can-i-have-multi-select-custom-field-behave-like-components-versions-fields
The thing is: All work fine, until you change the Issue Type while editing the Issue, then the Field reverts back to plain multiselect.
Is there a way to modify the JS to stop this behavior?
@Jamie Echlin : Pretty please...:-)
Here solution, that works for me
<script type="text/javascript"> (function($) { AJS.toInit(function(){ // init element on load new AJS.MultiSelect({ element: $("#customfield_10200"), itemAttrDisplayed: "label", errorMessage: AJS.params.multiselectComponentsError }); }) JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { // init element on refresh new AJS.MultiSelect({ element: $("#customfield_10200"), itemAttrDisplayed: "label", errorMessage: AJS.params.multiselectComponentsError }); }); })(AJS.$); </script>
Hi Grigory - Thanks a lot! That did work...however...
If I close the issue popup and open it again without reloading the whole page by browser refresh, I get the following phenomenon:
The input box multiplies depending on how often I open/close the popup (see screen below)
this seems releted to the "JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED.." part, since removing this part fixes the issue (or maybe its the init of the 2 elements)
Any idea how to fix this bugger? (getting so close now!)
1000 x thanks in advance....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here you go:
<script type="text/javascript"> (function($) { function convertMulti(id){ if (AJS.$('#'+id+"-textarea").length == 0){ new AJS.MultiSelect({ element: $("#"+id), itemAttrDisplayed: "label", errorMessage: AJS.params.multiselectComponentsError }); } } AJS.toInit(function(){ convertMulti("customfield_10200"); }) JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { convertMulti("customfield_10200"); }); })(AJS.$); </script>
Hope, it helped :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Grigory ,
yes, that finally did the job!
Thanks a lot, big Karma reward from me...;-)
For future reference - The whole thing (with removal of the "None" value).
<script type="text/javascript"> (function($) { // "customfield_10400" is the number of the custom // multiselect field you want to change as e.g. // seen at the end of the "configure" page url of // the field you want to change this way AJS.$("#customfield_10400 option[value='-1']").remove(); //Removes the default value "None" function convertMulti(id){ if (AJS.$('#'+id+"-textarea").length == 0){ new AJS.MultiSelect({ element: $("#"+id), itemAttrDisplayed: "label", errorMessage: AJS.params.multiselectComponentsError }); } } AJS.toInit(function(){ convertMulti("customfield_10400"); }) JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { AJS.$("#customfield_10400 option[value='-1']").remove(); convertMulti("customfield_10400"); }); })(AJS.$); </script>
Thanks again...
Cheers,
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
first, Project A has custom field with the above script in description. Project B does not have that custom field.
So, When im at dashboard, and click create project, by default if it starts with attempting to create issue in project B(as that was the last project i was navigating) but i switch so that i want issue to be created in project A, my multi select option in Project A looks like the original multi select(the script has not had any effect)
This does work correctly for me however, if i navigate to Project A, then click on create issue.
I hope this makes sense.
Is it possible to adapt code to work for this problem?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Grigory!!! You're a freaking genious!!!!!! Thank you so much. You rock big time!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am facing the same issue as described by Michal Crkon in the comment mentioned above:
Project A has custom field with the javascript for multiselect in description. Project B does not have that custom field.
So, When im at dashboard, and click create project, by default if it starts with attempting to create issue in project B(as that was the last project i was navigating) but i switch so that i want issue to be created in project A, my multi select option in Project A looks like the original multi select.
Please let me know if there is anyway to resolve this ?
Thanks,
Karan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi guys,
I have got the same problem as Michal Crkon. Does anybody has an update about this?
Cheers, Björn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
first, Project A has custom field with the above script in description. Project B does not have that custom field.
So, When im at dashboard, and click create project, by default if it starts with attempting to create issue in project B(as that was the last project i was navigating) but i switch so that i want issue to be created in project A, my multi select option in Project A looks like the original multi select(the script has not had any effect)
This does work correctly for me however, if i navigate to Project A, then click on create issue.
I hope this makes sense.
Is it possible to adapt code to work for this problem?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
would someone please post the edit.vm file. I couldn't get this to work.
Thanks very much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are saying that when you create an issue you select the project then the issue type then click on next , then you fill the details . at this time the field behaves like a component field until you change the issue type , right ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mizan,
I sure did that - however the result was: nothing at all happened - no masking.
So I guess somethings wrong: Either in the code itself or the wrong listener.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How have you applied your script ? i mean have you pasted it in the field configuration>>field description ?
Try to check what happens when the script is placed in the announcement banner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nobody knows how to do this? Come on guys - The searcheable MS is sooo much better than the plain one - especially when dealing with 50+ values...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Grigory, below is the code I use to *almost* sucessfully mask the multiselect field:
AJS.$("#customfield_10400 option[value='-1']").remove(); (function($){ new AJS.MultiSelect({ element: $("#customfield_10400"), itemAttrDisplayed: "label", errorMessage: AJS.params.multiselectComponentsError }); })(AJS.$);
I tried something like:
(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { (function($){ new AJS.MultiSelect({ element: $("#customfield_10400"), itemAttrDisplayed: "label", errorMessage: AJS.params.multiselectComponentsError }); }) }); })(AJS.$);
Result: Nothing works, the Field is not masked at all
- JS Noob-1 here - What did I do wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe you can try to listen for NEW_CONTENT_ADDED event and paste multiselect transformation code there?
(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { >>PASTE-CODE-HERE<< }); })(AJS.$);
There was a bug, that this event didn't triggered on early 5 version, but I saw that it was fixed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mizan,
only when I change the Isssue Type, since that seems to prompt reloading of the window.
Reloading by browser is not possible since that closes the window
Browsers: IE 8 and Firefox 12 - The same...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What happens when you dont change Issue type and change some other field or just refresh , did you check if this occurs on other browsers too ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.