Custom field show up if a specific option was chosen in a selct field - how to?

Rumceisz October 24, 2013

Hi All,

we'd configure a special screen: when the user chose a special option in a select list then aanother custom field will show up. The cascading select list would be good but the new custom field must be free text field. It would be like the Other option in some cases: when you choose the Other then a free text field shows up. This is what we need.

Dou you have any suggestion?

Thanks in advance,
Rumi

1 answer

1 accepted

0 votes
Answer accepted
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2013

try this script

<script type="text/javascript">  
jQuery(document).ready(function($) {
	JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {				
				showHideFieldFunction();
			});
			showHideFieldFunction();
			
function showHideFieldFunction(){
			showHideField();
			$('#customfield_10933').change(function() {		
				showHideField();
			});	
}

function showHideField(){
	var selectListSelectedValue=$("#customfield_10933 option:selected").text();
	if(selectListSelectedValue == 'Yes'){
	//Text area field
		$('#customfield_10934').closest('div.field-group').show();
	}esle{
		$('#customfield_10934').closest('div.field-group').hide();
	}

}
});
</script>

Rumceisz October 24, 2013

Hello,

many thanks for the help!

+1 question: where do we put this script?

Thanks,
Rumi

RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2013

you have to add it in text field description on field configutaion scheme

another way is you can load it as webreource module in plugin

Suggest an answer

Log in or Sign up to answer