make field required based on another field using behaviours plugin bug?

fabby January 6, 2013

my jira version is 4.4.1,behaviours plugin version is 0.5.0

1. there are two fields:'ToolType' and 'Description'.

'ToolType' is of Cascading Select type , and it has set its first default value as Camera,the second default value is not set.

'Description' is of Text Field type.

2. i want to make 'Description' required when 'ToolType' select value Camera

i wrote the following code

FormField tl = getFieldById("customfield_11500")
FormField des = getFieldById("customfield_11501")
if (tl.getValue().contains('Camera')){
 des.setRequired(true)
}else{
 des.setRequired(false)
}

problem one:

on create screen,'Description' is not required,although 'ToolType' has default value Camera.

problem two:

when choose LCD as 'ToolType' value, 'Description' is not required. click 'Description' text box, it is still not required as expected.

while once i have choosed Camera as 'ToolType',of course 'Description' is shown required.

then i choose LCD,'Descrption' is shown unrequired as expected.but when i click the 'Description' text box.it is shown required !!! and later 'Description' will display required as long as it is clicked ,no matter what 'ToolType' is chosen.

5 answers

0 votes
fan September 8, 2015

Hi Jamie, I am facing the same sitaution with select list field. I have already raised it in the forum https://answers.atlassian.com/questions/24646237 Colud please suggest a solution for this. Thanks and Regards Neena

0 votes
JamieA
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.
September 8, 2015

We are adding support for cascading selects, it will be released soon.

0 votes
NeenaR September 7, 2015

Hi Anyone found a solution for this? Thanks Neena

0 votes
Andrei [errno]
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.
April 10, 2013

have you figured out the solution to your problem?

0 votes
JamieA
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 6, 2013

> if(tl.getValue().contains('Camera')){

Log to your console t1.getValue(). As it's a cascading select you are probably getting a map or a list. But if you add some debug either you will figure it out or I will be able to.

fabby January 7, 2013
FormField jl = getFieldById("customfield_11500")
FormField des2 = getFieldById("description")
FormField des = getFieldById("customfield_11501")
if (jl.getValue().contains('Camera')){
 des.setRequired(true)
 des2.setFormValue(jl.getValue()+"\nfirst\n"+jl.getValue().contains('Camera'))
}else{
 des.setRequired(false)
 des2.setFormValue(jl.getValue()+"\nsecond\n"+jl.getValue().contains('Camera'))
}

my step:

create issue

choose LCD,desc2 shows 'LCD,' .click the 'Description' text box,it is not required.

then choose Camera,desc2 shows 'Camera,' .'Description' is required.

choose LCD,desc2 shows 'LCD,' click the 'Description' text box,it is required.

fabby January 8, 2013

anyone can git any idea??

JamieA
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 8, 2013

What's the question? I don't understand your comment above, and I don't see the debug lines I recommended.

Suggest an answer

Log in or Sign up to answer