Pop up a user picker window.

Alok Agnihotri February 18, 2014

Hi,

We want to provide a "user picker field" when a user selects a "yes" on a custom radio type field.

It means the create issue screen has a radio custom field with options Yes and No. When a user selects "yes", we want an additional "user picker" field to appear on the screen.

Please suggest any appropriate solution?

3 answers

1 accepted

1 vote
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.
February 18, 2014

as @zezetosaid, add user picker field to create screen and add the following script on announcement banner by replacing custom field id's

<script type="text/javascript">  
jQuery(document).ready(function($) {	
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {	
	showHideFunction();
});
	showHideFunction();
function showHideFunction(){	
			showHideUserPickerField();		
		$('input:radio[name=customfield_10001]').click(function() {			
			showHideUserPickerField();
		});	
		
			
}
	function showHideUserPickerField(){			
		var radioButtonVal =$('input[name=customfield_10001]:checked + label').text();		
		if( radioButtonVal == "Yes" ){			
			$("#customfield_10002").closest('div.field-group').show();			
		}else {
			$('#customfield_10002').val('');
			$("#customfield_10002").closest('div.field-group').hide();	
		}
	}
	
});
</script>

Alok Agnihotri February 19, 2014

@zezoto

@rambaran

Thanks for the response!
I tried this JS script in description of radio field as well as in announcement banner.

Still the other user picker field is not showing up?

Any idea about the problem?

Plz suggest.

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.
February 19, 2014

did you added user picker field to the create issue screen?

did you replaced custom field id?

Alok Agnihotri February 19, 2014

yes I have added user picker field and replaced "customfield_10001" with radio field id and
customfield_10002 with user picker id.

0 votes
Nadir MEZIANI
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.
February 22, 2014

Hi,

If your radio buton is like this

<fieldset class="group">
	<legend><span>User picker? <span class="aui-icon icon-required">required</span></span></legend>
	<div class="radio">
			<input type="radio" value="11142" name="customfield_10001" id="customfield_10001-1" class="radio" checked="checked">
			<label for="customfield_10001-1">No</label>
	</div>
	<div class="radio">
		<input type="radio" value="11143" name="customfield_10001" id="customfield_10001-2" class="radio">
		<label for="customfield_10001-2">yes</label>
	</div>
   <div class="description"></div>
</fieldset>

Put this script in description of your user picker field

<script type="text/javascript">

if(AJS.$('#customfield_10001-1').is(':checked')){AJS.$('#customfield_10002').parent().hide();}
AJS.$('#customfield_10001-1').click(function(){AJS.$('#customfield_10002').parent().hide();AJS.$('#customfield_10002').val();})
AJS.$('#customfield_10001-2').click(function(){AJS.$('#customfield_10002').parent().show();})
</script>


0 votes
Nadir MEZIANI
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.
February 18, 2014

Hi,

I think that the unique solution is to create a select user custom field, add it to create issue screen and put a javascirpt code that hide or show this field in the description of your radio buton field.

Suggest an answer

Log in or Sign up to answer