I have multiselect field which is having some 40 value , I have a requirement that if the user select some fields from that field then i have to show the selected fields in a drop down field which will be another custom field jus below it .. I dont know how to do this ... Please let me know how can we do this (some js code in description becoz i dont want to use groovy here )
Thanks in Advance..
Community moderators have prevented the ability to post new answers.
I have done few modification and the code is working now :
<script type="text/javascript"> jQuery('#customfield_13181').change(function(){ jQuery("#customfield_12981 option[value!='-1']").each(function() { jQuery(this).remove(); }); var options = []; jQuery('#customfield_13181 :selected').each(function(i, selected){ options[i] = jQuery(selected).text(); }); var dList =jQuery('#customfield_12981') jQuery.each(options, function(index, item) { dList.append('<option>'+item+'</option>'); }); }); </script>
Hi,
I got one more error now :(
Its while submitting the request . I am selecting 4 values in the multi select field - say val1, val2,val3 ,val4
These are well generated in the next field but when i select the option val1, I get the below error:
Invalid value 'val1' passed for customfield 'Select field value'. Allowed values are: 50992[val4], 50993[val3], 50994[ val2 ], 50995[val1], -1
Please suggest
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On further investigation i found that the id is not there with <option> tag not how can we add that. I have found this when i made another drop down field with some values... u can also check in the same way
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You could resolve this by :
1-create a dropdown list with the same values of multi select list
2-remove all values in drop down list which are not selected in multi select list
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
This script work
<script type="text/javascript">
var dListOptions = [];
var mListOptions = [];
jQuery("#customfield_10201 option[value!='-1']").each(function(i, option){
dListOptions[i] = jQuery(option);
});
jQuery("#customfield_10201 option[value!='-1']").each(function() {
jQuery(this).remove();
});
jQuery('#customfield_10200').change(function(){
jQuery("#customfield_10201 option[value!='-1']").each(function() {
jQuery(this).remove();
});
jQuery('#customfield_10200 :selected').each(function(i, selected){
mListOptions[i] = jQuery(selected).text().trim();
});
jQuery(dListOptions).each(function (i,option){
if(jQuery.inArray(jQuery(option).text(),mListOptions)>-1){
jQuery("#customfield_10201").append(option);
}
})
});
</script>
Where
#customfield_10201 : the drop down list id
#customfield_10200: the multi select list
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm working on something similar to this, I have one custom Jira field where the selection the user makes there will drive the selections on 3 other custom fields. I'm having some difficulty in making the linkage..if I have Jquery (or other javascript) that would need to fire when the first custom field value is selected (then use that selection to determine the options for the other fields), where would this javascript reside? In a js file deployed w/ my Custom Field plugin or in the configuration (admin page for custom fields) somewhere?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Robert,
you can give your js or jquery code in the Description box of that custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In jira 5.2.8 it' work like this:
in the description of your custom field :
jQuery('#multiselect field id').change(function(){ jQuery("dropdown field id option[value!='-1']").each(function() { jQuery(this).remove(); }); var options = []; jQuery('#multiselect field id :selected').each(function(i, selected){ options[i] = jQuery(selected).text(); }); var dList =jQuery('dropdown field id') jQuery.each(options, function(val, text) { dList.append(jQuery('<option></option>').val(val).html(text)); }); });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have added the below code in the drop down field :
<script type="text/javascript"> jQuery('#customfield_ 13181').change(function(){ jQuery("dropdown field id option[value!='-1']").each(function() { jQuery(this).remove(); }); var options = []; jQuery('#customfield_ 13181 :selected').each(function(i, selected){ options[i] = jQuery(selected).text(); }); var dList =jQuery('#customfield_12981') jQuery.each(options, function(val, text) { dList.append(jQuery('<option></option>').val(val).html(text)); }); }); </script>
but when i select some options from the customfield 13181 (which is my multi select field) nothing happened. JIRA version is 5.2.4 but I dont think that will matter in this case. Please check
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you have omitted jQuery("dropdown field id option[value!='-1']").each(function() {
jQuery(this).remove();
});
dropdown field id with
#customfield_12981
<script type="text/javascript"> jQuery('#customfield_ 13181').change(function(){ jQuery("#customfield_12981 option[value!='-1']").each(function() { jQuery(this).remove(); }); var options = []; jQuery('#customfield_ 13181 :selected').each(function(i, selected){ options[i] = jQuery(selected).text(); }); var dList =jQuery('#customfield_12981'); jQuery.each(options, function(val, text) { dList.append(jQuery('<option></option>').val(val).html(text)); }); }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
like i have a multiselect custom field with values - a1 a2 a3 a4 a5 a6 a7 a8 a9 a0;
suppose we select three options - a1 a3 a4
then the field which is drop down will be auto generated with the above 3 values (initially it was null)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You explain me more; values example
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.