Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancramerdesign committed Feb 13, 2024
1 parent db358ee commit a5f6cab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions wire/templates-admin/scripts/inputfields.js
Expand Up @@ -137,7 +137,7 @@ var Inputfields = {
* Are we currently in debug mode?
*
*/
debug: false,
debug: true,

/**
* Are we currently processing dependencies?
Expand Down Expand Up @@ -1099,11 +1099,22 @@ function InputfieldDependencies($target) {
* @param operator
* @param value value to match for
* @param conditionValue
* @param $inputfield
* @return int 0=value didn't match, 1=value matched
*
*/
function matchValue(field, operator, value, conditionValue) {
function matchValue(field, operator, value, conditionValue, $inputfield) {
var matched = 0;

if(operator === '=' || operator === '!=') {
if($inputfield.attr('class').indexOf('InputfieldPage') > -1) {
// InputfieldPage, InputfieldPageListSelect, InputfieldPageAutocomplete, etc.
// normalizing matching of empty for blank, '', "", 0, etc.
// since there is no page ID=0 so all empty values can match each other
var v = trimValue(value.toString() + conditionValue.toString());
if(v === '0' || v === '') value = conditionValue = '';
}
}

switch(operator) {
case '=': if(value === conditionValue) matched++; break;
Expand Down Expand Up @@ -1369,7 +1380,7 @@ function InputfieldDependencies($target) {
for (var n = 0; n < values.length; n++) {
for (var i = 0; i < condition.values.length; i++) {
var v = parseValue(values[n], condition.values[i]);
matched += matchValue(conditionField, condition.operator, v, condition.values[i]);
matched += matchValue(conditionField, condition.operator, v, condition.values[i], $inputfield);
}
}

Expand Down

0 comments on commit a5f6cab

Please sign in to comment.