Im trying to write a validation where is checks to see if the option "Other" is selected in the single selection list called test type list (cf_10619). if option "other" is selected then test Type "Other" (cf_10620) is required, otherwise it is not required.
So far i have tried the below - but this just returns a boolean that something has been selected from the the test type list (cf_10619) and that test type other (cf_10620) is not empty.
No matter which selection is made, this always requires Test Type "other" to be required
issue.customfield_10619.value == "Other" && !! issue.customfield_10620
using JWME and unfortunately im not a developer so im sure this is the basics of JS development that i do not know.
Any help would be greatly appreciated.
After playing with this for a little i was able to get this to work by using the below code. if anyone knows are more elegent way to do this, please let me know.
Code that worked:
issue.customfield_10619.value != "Other" || ( issue.customfield_10619.value == "Other" && !! issue.customfield_10620 )
Hi Julian,
you can actually simplify your expression this way:
issue.customfield_10619.value != "Other" || !! issue.customfield_10620
because if the first part of the expression is false, it means that issue.customfield_10619.value == "Other" so you don't have to test it again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks David, that simplified it a lot actually. Thanks for the explanation as well!
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.