<script type="text/javascript">
var field = document.getElementById('customfield_10106');
if (field)
{
target = document.getElementById('customfield_10107').parentNode;
if (field.value != 'yes')
target.style.display='none';
field.onchange=function()
{
if (this.value == 'yes')
target.style.display = '';
}
}
</script>
JIRA supports jQuery. Try this code. Customfield_10000 is the radio button. Customfield_10001 is the text field. The value of “Yes” = 10000. Your value could be different.
<script type="text/javascript">
jQuery(function($){
$(document).ready(function(){
var currentValue = $('input:radio[name=customfield_10000]:checked').val();
if(currentValue == "10000") //The value in JIRA is numeric
$("#customfield_10001").parent("div").show();
else
$("#customfield_10001").parent("div").hide();
$('input:radio[name=customfield_10000]').click(function(){
var checkedValue = $('input:radio[name=customfield_10000]:checked').val();
if(checkedValue == "10000")
$("#customfield_10001").parent("div").show();
else {
$("#customfield_10001").val(""); //remove the value of the text field so it does not show
$("#customfield_10001").parent("div").hide();}
});
});
});
</script>
thanks RON, thank you so much, i will right away check the code..............no my target is to get plug-in for velocity field and embed javascript into it. do u have any idea regarding this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
because i was writing my code into another text field named TEST, but it appears on screen, so i need velocity field so that javascript could be written in der and it will not appear on screen............
thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you can use the “Message Custom Field (for edit)” from the Atlassian JIRA Toolkit Plug-in. The “Velocity processed Message Custom Field” is not needed for simple JavaScript. However, you can also paste the code in the description of the custom field. This is usually easier. I have done both.
Note: If your project has a Field Configuration, the description of the custom field in the field configuration overrides the description set in the custom field. Therefore, you should add the code to the description of the custom field in the field configuration.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hiiiiii
i am using jira 4.4.4
please sujjest me with answer since i am eagerly waiting for ur response.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let me know the which version of Jira ur using
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's a bit hard to troubleshoot this without your custom fields installed. There's a bunch of discussion and comments on Displaying a Custom Field base on another field's selection. Have a look there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks JEREMY but i dint get u. what do u mean by without the custom field installed. i am trying on a simple screen which has radio button,textfield and lastly again the text field on which javascript is written. i am able to hide the first textfield but i need it to reappear when radio button is clicked on YES.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<script language="javascript" type="text/javascript">
source = document.getElementById('customfield_10106-1');
target = document.getElementById('customfield_10107').parentNode;
var noneFormField = document.getElementById ('cf-customfield_10106');
if (noneFormField)
{ var parentDiv = noneFormField.parentNode;
parentDiv.style.display="none"; }
window.onload = function(){
validatedisplay();
}
if(source != null){
source.onchange=function() {
validate();
}
}
function validatedisplay(){
target.style.display = 'none';
}
function validate(){
if(source.value="10107"){
target.style.display = '';
}
else
target.style.display = 'none';
}
</script>
above code works well but when user clicks second time the text field doesnt hide.
please sujjest me what do i do. i am using jira 4.4
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I mean I don't have the specific custom fields you do, so I can't easily try. What are customfield_10106 and customfield_10107?
Try this:
That would write out the value of the field. Then you can get the comparison statements right.
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.