Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Dear All,
Good day to you.
Scenario: I have a date field let say I called it Date A. Users can select the value of the field from certain status. Let say users change the date/update the date a new select list field need to be shown. The criteria is that the first time they select field it should not display the hidden field. But when they change the date for second time it should display the date.
Possible Solution: I know this will require java script to be added to the field. I am stuck on the part how do i compare the date change to display the field.
Existing Script
I have an exiting script that hide a text field based on selection field as shown below. I am planning to modify this to show hidden field once the date value is changed but do not sure on the compare part for the date field. should i compare it such as if date field is > today's value then display the field?:
<script type="text/javascript">
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
callChangeFunction();
});
callChangeFunction();
function callChangeFunction(){
showHidField();
// dropdown custom field change function
$("#customfield_14519").change(function() {
showHidField();
});
}
function showHidField(){
//drop down field selected value
var dropDownFieldval = $.trim($("#customfield_14519 :selected").text());
//test field1
$("#customfield_14556").closest('div.field-group').hide();
if(dropDownFieldval == "Yes"){
$("#customfield_14556").closest('div.field-group').show();
}else{
$('#customfield_14556').val('');
$("#customfield_14556").closest('div.field-group').hide();
}
}
});
</script>
Any suggestion is appreciated.
Cheers,
Shan
Hello @JCFP Admin
I have implemented something similar but no using JS but rather using Behaviour module of the Script runner plugin.
https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html
https://scriptrunner.adaptavist.com/latest/jira/recipes/behaviours.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.