The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Limit range of Number Field

Mikkel Kragelund Nielsen
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 Champions.
August 11, 2013

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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 Champions.
August 11, 2013

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>

Mikkel Kragelund Nielsen
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 Champions.
August 11, 2013

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>
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 Champions.
August 11, 2013

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

Mikkel Kragelund Nielsen
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 Champions.
August 14, 2013

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

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 Champions.
August 14, 2013

field description on field configuration right?

Vinod Honnalli
Contributor
January 27, 2016

The above code is not working.

can anyone suggest the right code??