google-code-export / openesignforms

Automatically exported from code.google.com/p/openesignforms
1 stars 0 forks source link

Multi-select dropdown fields cannot be compared #138

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a document with a multi-select drop down.
2. Create a rule/action that fires when a given value is selected using a 
comparison condition.

What is the expected output? What do you see instead?

When only the one value is selected, the comparison condition will work, or if 
the one value is the first of the selected values.  But if you select any value 
that's before the one you are testing for, it will not find it.

Original issue reported on code.google.com by yoz...@gmail.com on 12 Aug 2014 at 9:52

GoogleCodeExporter commented 9 years ago
Turns out that a multi-select dropdown is the only type now that returns an 
array of values.  So the comparison is only working on the first selected 
value.  All subsequently selected values are never compared.

Original comment by yoz...@gmail.com on 12 Aug 2014 at 9:52

GoogleCodeExporter commented 9 years ago
There is no obviously correct way to check if a single value matches an array 
of values, but the updated logic essentially is true if the condition holds 
true for ANY of the values in the array.  

So any comparison condition against an array of values will check all values in 
the array for the condition, and if any are true, the condition will be true.  
For non-array fields (all non-multi-select dropdowns), this works as before as 
there's just one value be checked.

If you need it to be exclusive, you oddly need to make two rules one checking 
IF it has your value and the other checking if it DOESN'T have your value:

field EQUALS "A" AND field NOT EQUALS "A"

This seems odd, and of course only applies to multi-select dropdowns, but it 
first checks if "A" was selected all, but also sees if anything other than A 
was entered.  If just "A", this will be false, but if it's A and anything else, 
it will be true.

Original comment by yoz...@gmail.com on 12 Aug 2014 at 10:02