Skip to content

Commit

Permalink
fix conditional logic with invisible columns
Browse files Browse the repository at this point in the history
  • Loading branch information
RensTillmann committed Jun 1, 2023
1 parent cef87c7 commit 8fdc9d4
Show file tree
Hide file tree
Showing 8 changed files with 1,152 additions and 1,106 deletions.
3 changes: 2 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- [PDF Generator Add-on](https://renstillmann.github.io/super-forms/#/pdf-generator-add-on)

## May 31, 2023 - Version 6.3.724
## Jun 02, 2023 - Version 6.3.725

- **Added:** Option to create vCards and attach them to Admin and Confirmation E-mails via `Form settings > vCard Attachment`
- **Added:** New `Signature` drawing method for improved device compatibility (Microsoft Surface Pro)
Expand Down Expand Up @@ -49,6 +49,7 @@ endforeach;
- **Fix:** Issue when dragging elements inside column that are inside an Accordion/TAB element
- **Fix:** Issue with using `foreach loop` inside E-mails not replacing the tags with field value correctly
- **Fix:** New signature mobile canvas width not adjusting properly
- **Fix:** Conditional logic conflict with columns that are set to be hidden in some scenario's

## Dec 21, 2022 - Version 6.3.679

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

// @since 1.5.0 - skip if parent column or element is hidden (conditionally hidden)
if(typeof doNotSkip === 'undefined') {
if(SUPER.has_hidden_parent(target)){
if(SUPER.has_hidden_parent(target, false, false)){
continue;
}
}
Expand Down Expand Up @@ -301,7 +301,7 @@
}

// Check if parent column or element is hidden (conditionally hidden)
if(SUPER.has_hidden_parent(element)){
if(SUPER.has_hidden_parent(element,false,false)){
// Exclude conditionally
// Lets just replace the field name with 0 as a value
numericMath = target.dataset.superNumericMath.replace('{'+oldName+'}', 0);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/assets/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ function SUPERreCaptcha(){
SUPER.field_isset = function(form, name, regex){
var el = SUPER.field(form, name, regex);
if(!el) return 0; // does not exist, is not set
if(SUPER.has_hidden_parent(el)) {
if(SUPER.has_hidden_parent(el,false,false)) {
return 0; // was conditionally hidden
}
return 1;
Expand Down Expand Up @@ -1885,7 +1885,7 @@ function SUPERreCaptcha(){
$continue = true;
continue;
}
$skip = SUPER.has_hidden_parent($shortcode_field);
$skip = SUPER.has_hidden_parent($shortcode_field, false, false);
$parent = $shortcode_field.closest('.super-shortcode');
}
if(v.a!==''){
Expand All @@ -1904,7 +1904,7 @@ function SUPERreCaptcha(){
$continue_and = true;
continue;
}
$skip_and = SUPER.has_hidden_parent($shortcode_field_and);
$skip_and = SUPER.has_hidden_parent($shortcode_field_and, false, false);
$parent_and = $shortcode_field_and.closest('.super-shortcode');
}
if(v.a==='or' && !$continue_and){
Expand Down
9 changes: 0 additions & 9 deletions src/assets/js/frontend/elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,6 @@
});

$doc.on('click', '.super-form .super-duplicate-column-fields .super-add-duplicate', function(){
debugger;
var i, x, nodes, el, parent, column, form, firstColumn, lastColumn,
found, limit, unique_field_names = {}, field_names = {}, field_labels = {}, counter = 0,
field, clone, added_fields_with_suffix = {}, foundElements = [], html_fields, suffix, name,
Expand Down Expand Up @@ -2145,26 +2144,18 @@
counter = column.querySelectorAll(':scope > .super-duplicate-column-fields, :scope > .super-column-custom-padding > .super-duplicate-column-fields').length;
clone = firstColumn.cloneNode(true);
lastColumn = duplicateColumns[(found-1)];
debugger;
lastColumn.parentNode.insertBefore(clone, lastColumn.nextElementSibling);
// @since 3.3.0 - hook after appending new column
debugger;
SUPER.after_appending_duplicated_column_hook(form, unique_field_names, clone);
// Now reset field values to default
debugger;
SUPER.init_clear_form({form: form, clone: clone});

// First rename then loop through conditional logic and update names, otherwise we might think that the field didn't exist!
// Loop over all fields that are inside dynamic column and rename them accordingly
debugger;
SUPER.append_dynamic_column_depth({form: form, clone: clone});
debugger;
SUPER.init_common_fields();
debugger;
SUPER.init_replace_html_tags({el: undefined, form: clone});
debugger;
SUPER.after_duplicating_column_hook(form, unique_field_names, clone);
debugger;
SUPER.after_field_change_blur_hook({form: clone, el: undefined});
});

Expand Down
3 changes: 2 additions & 1 deletion src/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- [PDF Generator Add-on](https://renstillmann.github.io/super-forms/#/pdf-generator-add-on)

## May 31, 2023 - Version 6.3.724
## Jun 02, 2023 - Version 6.3.725

- **Added:** Option to create vCards and attach them to Admin and Confirmation E-mails via `Form settings > vCard Attachment`
- **Added:** New `Signature` drawing method for improved device compatibility (Microsoft Surface Pro)
Expand Down Expand Up @@ -49,6 +49,7 @@ endforeach;
- **Fix:** Issue when dragging elements inside column that are inside an Accordion/TAB element
- **Fix:** Issue with using `foreach loop` inside E-mails not replacing the tags with field value correctly
- **Fix:** New signature mobile canvas width not adjusting properly
- **Fix:** Conditional logic conflict with columns that are set to be hidden in some scenario's

## Dec 21, 2022 - Version 6.3.679

Expand Down
Loading

0 comments on commit 8fdc9d4

Please sign in to comment.