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 Leaders.
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

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.
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 Leaders.
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 Leaders.
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 Leaders.
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 Leaders.
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??

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team '25 europe, atlassian event, barcelona 2025, jira, confluence, atlassian intelligence, rovo, ai-powered collaboration, developer tools, agile teams, digital transformation, teamwork solutions, atlassian conference, product announcements

🌆 Team '25 Europe registration is now open!

Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.

Register now
AUG Leaders

Atlassian Community Events