Skip to content
Snippets Groups Projects

Issue #1149078: States API doesn't work with multiple select fields

Open Issue #1149078: States API doesn't work with multiple select fields
2 unresolved threads
2 unresolved threads
Files
3
+ 10
0
@@ -149,6 +149,7 @@
@@ -149,6 +149,7 @@
*
*
* @prop {function} RegExp
* @prop {function} RegExp
* @prop {function} Function
* @prop {function} Function
 
* @prop {function} Array
* @prop {function} Number
* @prop {function} Number
Please register or sign in to reply
*/
*/
states.Dependent.comparisons = {
states.Dependent.comparisons = {
@@ -159,6 +160,15 @@
@@ -159,6 +160,15 @@
// The "reference" variable is a comparison function.
// The "reference" variable is a comparison function.
return reference(value);
return reference(value);
},
},
 
Array(reference, value) {
 
// Make sure value is an array.
 
if (!Array.isArray(value)) {
 
return false;
 
}
 
 
// The arrays values should match.
 
return JSON.stringify(reference.sort()) === JSON.stringify(value.sort());
 
},
Number(reference, value) {
Number(reference, value) {
// If "reference" is a number and "value" is a string, then cast
// If "reference" is a number and "value" is a string, then cast
// reference as a string before applying the strict comparison in
// reference as a string before applying the strict comparison in
Loading