Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can we hide comment field from a specific tab on a screen

Edited

Hello,

I have added a 2nd tab on the edit screen named "New Tab"(just for example) and wanted to ask if we can hide the comment field from only this tab using groovy. If I click on the default tab, the comment field should be there.

Let me know in either case.

Thanks in advance.

I have used below Jquery/JavaScript approach in initializer. Anything in groovy ?

def comment_field = getFieldById("comment")
def myScript = '''
<script>
AJS.$('[role="tab"]').click(function(){

let tabName = document.querySelector("li.active-tab > a[role='tab']").innerHTML;
if(tabName == "<strong>RCA</strong>"){
AJS.$('.comment-input').hide();
}
else{
AJS.$('.comment-input').show();
}
});
</script>
'''
comment_field.setHelpText (myScript)

 

 

1 answer

I tried building a solution for this using scriptrunner behaviours, but the problem is that I don't think you can get information about the current tab which you are on, except for when you initialise the screen which will always result in the default tab being returned.

def comment = getFieldById("comment")
def editTab = getFieldScreen().tabs.find {
return it
}

if (editTab.name.equals("Second Tab")) {
comment.setHidden(true)
} else {
comment.setHidden(false)
}

I hope someone are able to correct me :) 

Hi @Mathis Hellensberg ,

Thanks for your reply!!

I hope a community leader can help us here.

:-)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

333 views 3 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you