Hi,
I have a Jira form using checkboxes, so for each question I basically have:
Form checklist question:
[ ] N/A
[ ] Option 1
[ ] Option 2
[ ] Option 3
So upon submission, I need to validate the following:
1) Form can't be submitted empty (w/o selecting any options)
2) Form can't be submitted without selecting either "N/A" or at least one other option from options 1/2/3.
So we must consider:
- 2.1) IF "N/A" is selected, no other option can be selected and submitted
- 2.2) IF "N/A" is not selected then I have to have at least one other option selected
I was able to accomplish #1 above with the following:
(! issue.customfield_1 || issue.customfield_1.length > 0) && (! issue.customfield_2 || issue.customfield_2.length > 0) && so on...
Now, to accomplish #2, I've tried the following (1 field example):
(!!issue.customfield_1 && issue.customfield_1.some(it => it.value == "N/A")) && (!!issue.customfield_1 && issue.customfield_1.length = 1)
which is attempting to validate "IF N/A checkbox is selected AND the count on the number of checkboxes select = 1 THEN pass the validation" BUT this doesn't seem to be working...
What am I missing? Or what's the best path to validate this?
Thank you!