Limit range of Number Field

Hey Does anyone know how to limit a number field (Custom field), to a certain range. So it can only be 1-14 ex.

1 answer

1 accepted

try something like this with Javascript

<script type="text/javascript">
jQuery(document).ready(function($) {
	JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
		limitSize();
	});
		limitSize();
	
	function limitSize(){
				
				$('#customfield_13820').keyup(function(e){				
					var decimalValue = $("#customfield_13820").val();
					if(decimalValue < 1 || decimalValue > 14){
						alert("Value should be 1-14");						
						return false;
					}					
			});		
	}	
	
});
</script>

This dosen't work. What JIRA version are you on. Im on 5.2.9.

I can get the alert message to show if I delete everything else:

<script type="text/javascript">
alert("Value should be 1-14");
</script>

we are using jira 5.2.5,

where you have added javascript?

i suggest to add as it by changing custom field id on footer.jsp or load it add webresource in any plugin

I have just added it to the description of the field.

field description on field configuration right?

The above code is not working.

can anyone suggest the right code??

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,231 views 14 19
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot