Hi All
Recently I upgraded JIRA 4.1.1 to JIRA 4.4 and started facing some issues with the custom field scripting.
I used control the visibility of the text filed "Blocker Explanation" based on the value of the combo 'priority'. Seems the code doesn't work in JIRA 4.4. Below is the code I used in 4.1.1 ;
---------------------------
<script type="text/javascript">
priority = document.getElementById('priority');
if (priority) {
target = document.getElementById('customfield_10061FieldArea');
// Hide the target field if priority isn't a Blocker
if (priority.value != 1) target.style.display='none';
priority.onchange=function() {
if (this.value == 1) {
target.style.display = '';
} else {
target.value='n/a';
target.style.display='none';
}
}
}
</script>
---------------------------------
Going through some posts, I have tried the below codes too..no luck;
--------------------
<script type="text/javascript">
priority = document.getElementById('priority');
if (priority) {
target = document.getElementById('customfield_10061').parentNode;
// Hide the target field if priority isn't a Blocker
if (priority.value != 1) target.style.display='none';
priority.onchange=function() {
if (this.value == ) {
target.style.display = '';
} else {
target.value='n/a';
target.style.display='none';
}
}
}
</script>
----------------
Do we need to change anything in jira 4.4 ?
Any suggestions would be appricated.
Cheers !!
Vishnu.
Why don't you use jquery as below. Also your 1 should "1" as the priority value is a string.
Not complete example:
(function($){
$(function(){
$("#priority").change(function () {
if ($(this).val() == "1") {
$("#description").closest(".field-group").show();
}
else {
$("#description").closest(".field-group").hide();
}
})
});
})(AJS.$);
Thanks for the suggestion.
In fact priority values are "Blocker" "critical" etc...so if I say 1 thats "Blocker". This is how it worked in 4.1.1
In the above jql how can I assign target and priority ?
Please update that too...
Regards
Vishnu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's not 1, it's "1". It's the difference between an integer and a string. Javascript will coerce it for you so that's irrelevant anyway.
The above is javascript not JQL. I was only trying to give you a starter for 10, I haven't got time to write it for you completely.
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.