Skip to content

Commit

Permalink
multipart autostep bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RensTillmann committed Jun 29, 2020
1 parent d0d1729 commit 78fac66
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/assets/css/backend/create-form.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@

.super-backup-history.super-loading h2:after {
content: '\f1ce';
font-family: 'Font Awesome 5 Free';
display: inline-block;
font-size: 20px;
margin-left: 10px;
color: #dcdcdc;
}

.super-backup-history.super-loading h2:after {
Expand Down Expand Up @@ -2553,3 +2553,4 @@
padding: 0px 0px 30px 0px;
font-size: 16px;
}

36 changes: 21 additions & 15 deletions src/assets/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2425,29 +2425,35 @@ function SUPERreCaptcha(){

// @since 1.2.3
SUPER.auto_step_multipart = function(field, form){
var i,
nodes,
auto_step,
total_fields,
counter,
active_part = form.querySelector('.super-multipart.super-active');
if(active_part){
auto_step = active_part.dataset.stepAuto;
if( auto_step=='yes') {
total_fields = 0;
nodes = active_part.querySelectorAll('.super-shortcode-field');
// If triggered field change is not inside active multi-part we skip it
var activeMultipart = field.closest('.super-multipart.super-active');
if(!activeMultipart) return false;
var i, nodes, totalFields, counter;
if(activeMultipart){
if( activeMultipart.dataset.stepAuto=='yes') {
totalFields = 0;
nodes = activeMultipart.querySelectorAll('.super-shortcode-field');
for (i = 0; i < nodes.length; ++i) {
if(!SUPER.has_hidden_parent(nodes[i])) total_fields++;
if(!SUPER.has_hidden_parent(nodes[i])){
// Also exclude any hidden fields, because `has_hidden_parent()` doesn't check for this
if(nodes[i].type=='hidden'){
if(nodes[i].closest('.super-shortcode').classList.contains('super-hidden')){
continue;
}
}
totalFields++;
}
}
counter = 1;
nodes = active_part.querySelectorAll('.super-shortcode-field');
nodes = activeMultipart.querySelectorAll('.super-shortcode-field');
for (i = 0; i < nodes.length; ++i) {
if(!SUPER.has_hidden_parent(nodes[i])){
if(total_fields==counter){
if(totalFields==counter){
if(nodes[i].name==field.name){
setTimeout(function (){
active_part.querySelector('.super-next-multipart').click();
activeMultipart.querySelector('.super-next-multipart').click();
}, 200);
break;
}
}
counter++;
Expand Down
4 changes: 4 additions & 0 deletions src/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Super Forms - Changelog

## Jun 29, 2020 - Version 4.9.471

- **Fix:** Multipart autostep not working when having hidden fields at the bottom of a step

## Jun 18, 2020 - Version 4.9.470

- **Fix:** When using a predefined tag inside `Default value` setting in combination with a button with action set to `Clear/Reset form` it was replacing the field value to the raw {tag} instead of it's value
Expand Down
4 changes: 2 additions & 2 deletions src/super-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Plugin Name: Super Forms - Drag & Drop Form Builder
* Plugin URI: http://codecanyon.net/user/feeling4design
* Description: The most advanced, flexible and easy to use form builder for WordPress!
* Version: 4.9.470
* Version: 4.9.471
* Author: feeling4design
* Author URI: http://codecanyon.net/user/feeling4design
* Text Domain: super-forms
Expand All @@ -41,7 +41,7 @@ final class SUPER_Forms {
*
* @since 1.0.0
*/
public $version = '4.9.470';
public $version = '4.9.471';
public $slug = 'super-forms';


Expand Down

0 comments on commit 78fac66

Please sign in to comment.