Custom fields on create screen

Hi everyone,

When I create an issue I add a select list custom field. Depending the user selected option I need extra information so I need show different custom field (with diferent field types). I find documentation that explains how using javascript on the description custom fields you can hide it but the associated label is showed always on my jira version (5.2.11).

There any way to do this? I think about other solutions but i don't know if exists any. For example, Can I show automaticatly other screen after creation (configuring which screen depending the option selecten on custom field) and put in this more custom fields related with the first one?

Thanks

4 answers

1 accepted

Hi,

try the script below, this is exactly how we use it, just replace the customfield with the correct value

<script type="text/javascript">

	function selectedCorrectItem(){
		var controlCustomField = document.getElementById('customfield_10000');
		for (x=0;x<controlCustomField.length;x++){
			if (controlCustomField.options[x].selected) {
				if (controlCustomField[x].value == 'id_value'){
					return true;
				}
			}
		}
		return false;
	}
	
	controlCustomField = document.getElementById('customfield_10000');
		toHideCustomField = document.getElementById('customfield_10001');
		controlCustomField.onchange=function() {
			if (selectedCorrectItem()) {
				toHideCustomField.parentNode.style.display='';
			} else {
				toHideCustomField.value ='';
				toHideCustomField.parentNode.style.display='none';
				}
		}
 </script>

Thanks Eric, I test it and it works fine

Hi Nataila,

Not sure if it would help. But try the suggetion in link below.

http://stackoverflow.com/questions/17233782/how-to-create-cascade-multiple-select-list-custom-field

Vijay

Thanks but i think i doesn't work because in some cases when I choose an option from the first select I need 3 or 4 custom text field, but selectin other option maybe I nedd another select list.

The custom fieds need depend which select option you choose.

Hi,

Javascript is not recommended, but I think you forgot to install a node, parent node to hide the div Which Contain label and value.

can you post your script or an example?


Hi,

i know that javascript is not recomended but i don't find other way to do this after readind documentations and searchin on answers.

Here an example that when I chose one priority option I show a custom field that works but the label of the custom field is always showed:

<script type="text/javascript">

priority = document.getElementById('priority');

if (priority) {

target2 = document.getElementById('customfield_11001');

if (priority.value != 2) target2.style.display='none';

priority.onchange=function() {

if (this.value == 2) {

target2.style.display = '';

target2.value="enter message here for field camp11";

} else {

target2.style.display='none';

}

}

}

</script>

Hi,

Try this script

&lt;script type="text/javascript"&gt;
	AJS.$(document).bind('dialogContentReady', function(event, dialog) {
		priority = AJS.$('#priority');
		target2=AJS.$('#customfield_11001');
		if(priority.length&gt;0){
			if(priority.val!=2){
				target2.closest('div.field-group').hide();
			}
			priority.change(
				function(){
					if(priority.val()==2){
						target2.closest('div.field-group').show();
						target2.val('enter message here for field camp11');
					}
					else{
						target2.closest('div.field-group').hide();
						target2.val('')
					}
				}
			);
		}
	});
&lt;/script&gt;

Thaks, I test it but it doesn't works

Hi, what is the error ?

0 vote
Joe Wai Tye Atlassian Team Jun 16, 2014

Hey Natalia,

Could setting different screen schemes with different issue types work to suit your requirements? You can check out more about Issue Type Screen Schemes here - Associating Screen and Issue Operation Mappings with an Issue Type

Hi,

i read it when i was thinking how to do this. The problem is that for each issue type i need a list of "standard requests" for my project (a list). Some of the options on this "standard requests" need different extra information.. for example for the option A I need to fill a text field, for the option B I need to show a select list, etc.

Any suggestion how i can do this,

thanks

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

79 views 0 5
Read article

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