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

make field required only in one tab

Taras Gural Jan 18, 2018

hi,
I have a transition screen with 3 tabs. And wont to make comment field required only in one tab, in another it must be hiden. Can i make this with baheviour plugin?

2 answers

1 accepted

1 vote
Answer accepted
Alexey Matveev [cPrime] Community Leader Jan 18, 2018

I do not hink it is possible. Actually there is only 1 comment field and it is not linked to any tab. You can see it in the html code. That is why you should link behaviour to tabs and if a tab is activated you should hide or show the comment field depending on your logic. But it is not possible to link behaviour to a tab. 

Taras Gural Jan 18, 2018

thanks for your answer, but how I can chek which tab is activated?

Alexey Matveev [cPrime] Community Leader Jan 18, 2018

You can not do it with behaviours. You could do it with JavaScript but I would not do it.

Taras Gural Jan 18, 2018

ok, thanks.

Taras Gural Jan 18, 2018

one more question, can i set field as required based on selected value of another field? all fields are on transition screen

Alexey Matveev [cPrime] Community Leader Jan 18, 2018

Yes, you can do it. You need to add the field, which value influences the other field, to the behavour and put your logic in the script for the field

Taras Gural Jan 18, 2018 • edited
def problemField = getFieldByName("Field with value").getValue()
def sum = getFieldByName("first field to require")
def link = getFieldByName("second field to require")
if(problemField == "a" || problemField == "b" ){
sum.setRequired(true)
}else if(problemField =="c"){
sum.setRequired(true)
link.setRequired(true)
}

 I try to do it with this code. It works. But it does not make field required based on current walue. I must to perform transition(or save data to the field with value) and then, during next transition it will be required. But i wont to chang this in current time, not only after save.

Taras Gural Jan 18, 2018

def problemField = getFieldByName("Field with value").getValue()
def sum = getFieldByName("required field a")
def link = getFieldByName("required field b ")
if(problemField == "a" || problemField == "b" ){
sum.setRequired(true)
}else if(problemField =="c){
sum.setRequired(true)
link.setRequired(true)
}
i try to do it with this code. It works, but it make field required not in current time. I must to perform a transition, and then in next transition screen it will by OK. I wont to dynamicly change required or not. How i can do it?

Alexey Matveev [cPrime] Community Leader Jan 18, 2018

You need to add the problemField to the behavour (add field) and set the script for the field. In this case the script will fire all the time the problemField changes.

Taras Gural Jan 22, 2018

okey, thanks, now i try to make required field "Linked Issues" with this behaviour, but it dont works. 

1 vote
Joseph Pitt Community Leader Jan 18, 2018

Tabs are just a logical separation of a screen. To JIRA it is one screen so if the plugin can do it with a screen it should be able to do it with the tabs

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

2,045 views 6 15
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