Skip to content

Commit

Permalink
fix: improved file input type matching on frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoreMihai committed Mar 29, 2024
1 parent d15988f commit 4c1b593
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/ppom-conditions-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,9 @@ function ppom_check_conditions(data_name, callback) {

let is_matched = false;
const ppom_type = jQuery(`.ppom-input[data-data_name="${data_name}"]`).data('type');

const is_file = jQuery("a.file.ppom-input").length > 0;
let event_type, element_data_name;
// const field_val = ppom_get_element_value(data_name);
// console.log('data_name',data_name);

jQuery(`div.ppom-cond-${data_name}`).each(function() {
// return this.data('cond-val1').match(/\w*-Back/);
// console.log(jQuery(this));
Expand Down Expand Up @@ -326,7 +325,7 @@ function ppom_check_conditions(data_name, callback) {
}
});

if (typeof callback == "function" && ( 'undefined' !== typeof ppom_type || element_data_name !== 'file') )
if (typeof callback == "function" && ( 'undefined' !== typeof ppom_type || !is_file ) )
callback(element_data_name, event_type);
// return is_matched;
}
Expand All @@ -340,13 +339,14 @@ function ppom_check_conditions(data_name, callback) {
jQuery(this).addClass(`ppom-locked-${data_name} ppom-c-hide`);
}

if (typeof callback == "function" && ( 'undefined' !== typeof ppom_type || element_data_name !== 'file') )
if (typeof callback == "function" && ( 'undefined' !== typeof ppom_type || !is_file) )
callback(element_data_name, event_type);
} else {

jQuery(this).removeClass(`ppom-locked-${data_name} ppom-c-hide`);
// console.log('event_type', event_type);
if (typeof callback == "function" && ( 'undefined' !== typeof ppom_type || element_data_name !== 'file') )

if (typeof callback == "function" && ( 'undefined' !== typeof ppom_type || !is_file) )
callback(element_data_name, event_type);
}
}
Expand Down

0 comments on commit 4c1b593

Please sign in to comment.