Skip to content
Snippets Groups Projects
Commit a8a71c6d authored by catch's avatar catch
Browse files

Issue #879580 by arithmetric: Fixed States fail when using integer values for...

Issue #879580 by arithmetric: Fixed States fail when using integer values for select/radio dependencies.
parent ee406da5
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -63,6 +63,13 @@ states.Dependent.comparisons = { ...@@ -63,6 +63,13 @@ states.Dependent.comparisons = {
'Function': function (reference, value) { 'Function': function (reference, value) {
// The "reference" variable is a comparison function. // The "reference" variable is a comparison function.
return reference(value); 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);
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment