Hi All,
My select list custom field has default options, 1,2,3,4,5 , but i want to display only 1, 3 and 5 when i posted that question a user told me that i can write a java script by editing the custom field.
I tried it but it was not working, is any one has a sample that i can use or any other methods that i can use , please let me know. Editing the edit-select.vm file is also not working because i dont see those options and the custom field id in that file
Please help me out
Saran
First, make sure you have 1, 2, 3, 4 and 5 as the options - the principle here is to get Jira to serve up all of the options, and then remove the ones you don't want after it's rendered.
Second, you didn't say where your javascript is, or how you've embedded it, but the way to do it in off-the-shelf Jira is to add it to the description of a custom field. I've had problems doing that sometimes, unless I added it to the last field appearing on the screen. You could also add it to select.vm or maybe use message fields, but the other methods all require coding or plugins.
Third, some simple code
{code}
<script language="JavaScript" type="text/javascript">
<!--
window.onload = function()
{
var listBox = document.getElementById("customfield_10312");
if (listBox)
{
for (j = listBox.length - 1; j>=0; j--)
{
if (listBox.options[j].value=="2") { listBox.remove(j); }
if (listBox.options[j].value=="4") { listBox.remove(j); }
}
}
}
// -->
</script>
{code}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.