summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-09-30 13:01:51 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-09-30 13:01:51 -0700
commit246f5aec18b15893e4ab1c88574ac60af145401e (patch)
tree466f04b69e34176c86acc2159d12d3775a8026d1 /misc
parentdae58ccf1336bf4b23f4fba1f3b4603c359a327e (diff)
downloadbrdo-246f5aec18b15893e4ab1c88574ac60af145401e.tar.gz
brdo-246f5aec18b15893e4ab1c88574ac60af145401e.tar.bz2
Issue #879580 by arithmetric: Fixed States fail when using integer values for select/radio dependencies.
Diffstat (limited to 'misc')
-rw-r--r--misc/states.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/misc/states.js b/misc/states.js
index ec070c9a6..9b98d5dd2 100644
--- a/misc/states.js
+++ b/misc/states.js
@@ -63,6 +63,13 @@ states.Dependent.comparisons = {
'Function': function (reference, value) {
// The "reference" variable is a comparison function.
return reference(value);
+ },
+ 'Number': function (reference, value) {
+ // If "reference" is a number and "value" is a string, then cast reference
+ // as a string before applying the strict comparison in compare(). Otherwise
+ // numeric keys in the form's #states array fail to match string values
+ // returned from jQuery's val().
+ return (value.constructor.name === 'String') ? compare(String(reference), value) : compare(reference, value);
}
};