make field required only in one tab

Pumper1 January 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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 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. 

Pumper1 January 18, 2018

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

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 18, 2018

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

Pumper1 January 18, 2018

ok, thanks.

Pumper1 January 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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 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

Pumper1 January 18, 2018
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.

Pumper1 January 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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 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.

Pumper1 January 22, 2018

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

1 vote
Joe Pitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 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