Skip to content

Commit

Permalink
Conditional field don't reset field value on hide element - FIXED
Browse files Browse the repository at this point in the history
  • Loading branch information
kprajapatii committed Jul 31, 2024
1 parent d786d81 commit 0d4d9a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions change-log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
= 0.2.22 - TBD =
* Conditional field don't reset field value on hide element - FIXED

= 0.2.21 - 2024-07-31 =
* JS error on FSE theme edit template part page - FIXED

Expand Down
10 changes: 8 additions & 2 deletions includes/ayecode-ui-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3050,16 +3050,22 @@ function aui_cf_field_apply_action($el, rule, isTrue) {
var $destEl = jQuery('[data-rule-key="' + rule.key + '"]');

if (rule.action === 'show' && isTrue) {
if ($destEl.is(':hidden')) {
if ($destEl.is(':hidden') && !$destEl.hasClass('aui-cf-skip-reset')) {
aui_cf_field_reset_default_value($destEl);
}
aui_cf_field_show_element($destEl);
} else if (rule.action === 'show' && !isTrue) {
if (!$destEl.is(':hidden') && !$destEl.hasClass('aui-cf-skip-reset')) {
aui_cf_field_reset_default_value($destEl);
}
aui_cf_field_hide_element($destEl);
} else if (rule.action === 'hide' && isTrue) {
if (!$destEl.is(':hidden') && !$destEl.hasClass('aui-cf-skip-reset')) {
aui_cf_field_reset_default_value($destEl);
}
aui_cf_field_hide_element($destEl);
} else if (rule.action === 'hide' && !isTrue) {
if ($destEl.is(':hidden')) {
if ($destEl.is(':hidden') && !$destEl.hasClass('aui-cf-skip-reset')) {
aui_cf_field_reset_default_value($destEl);
}
aui_cf_field_show_element($destEl);
Expand Down

0 comments on commit 0d4d9a7

Please sign in to comment.