Hello, I am have been trying to display a field based on the value of a single select list using the example mentioned in the page below, but it doesnt work.
I read that it can be achieved using Behaviors in ScriptRunner?
Can I get some more information on how this could be done?
It's pretty much this exact recipe: https://scriptrunner.adaptavist.com/latest/jira/recipes/behaviours/select-list-other.html
I wrote my own updated version of that script, I can provide it –
<script type="text/javascript"> /*--------- Use Case ----------- Only show targetField when the changingField is set to desiredValue. ----------- This is using basic javascript and the jquery library provided by atlassian. This should be within the Field Description, within the Field Configuration. The jQuery can be accessed using the AJS.$ wrapper.*/ //Obtain the first field by ID changingField = document.getElementById('customfield_13322'); //Start our process if the field is present if (changingField) { //Desired value to show the target field desiredValue = '10939' //Obtain the second field by ID targetField = document.getElementById('customfield_13708'); // This first if-statement will hide the target field immediately, unless the default value is set to our desired value // Hide the target field's container if changing field isn't set the desired value if (changingField.value != desiredValue) AJS.$(targetField).parent().hide() // onchange runs when a select field changes. Basic logic here shows it for desired value, hides it for all else // Be sure to set the field to nothing when using the else clause to hide the field container, otherwise you'll still submit data changingField.onchange=function() { if (this.value == desiredValue) { AJS.$(targetField).parent().fadeIn( 200, "jswing" ) } else { targetField.value=''; AJS.$(targetField).parent().fadeOut( 200, "jswing" ) } } } </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately I haven't done this specific task with ScriptRunner Field Behaviors – You can look for hints or examples on the documentation page: https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html#_examples
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please advise how this can be done using a Cascading Select. I am not too familiar with java script. Might need to get sometime to learn more about JS.
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.