Upgrade to wordpress 5.6 FileUpload not working

fix ChronoForms file upload after WordPress 5.6 jQuery update.

Overview

The issue occurs because WordPress 5.6 updated jQuery to version 3.5.x, which causes a jQuery function used by CF to become undefined.
Modify the CF JavaScript file to replace the reference to the undefined jQuery function with a compatible alternative.

Co Collie-IT 23 Dec, 2020
Dear Support
Wordpress 5.6 change the JQuery Libery from 1.12.x auf 3.5.x.After the upgrade the upload is not working anymore. Following error was locked in the console.Upgrade to wordpress 5.6 FileUpload not working image 1
Can you give me an advice to get rit of this error?

Best Regards
Collie-IT
Co Collie-IT 23 Dec, 2020
Found some further informations. In wp-content\plugins\chronoforms\chronog3\assets\js\g3.forms.js in $.G3.forms.initializeForm jQuery.fn.form is undefinedIf I change the beginning as following the error disapeared and I can use the fileuploade again
(function($){
if($.G3 == undefined){
$.G3 = {};
}
$.G3.forms = {};
var settings= jQuery.fn.form.settings;
$.G3.forms.quickUpload = function(Widget, requestData){
$.ajax({
xhr: function(){
var xhr = new window.XMLHttpRequest();
xhr.upload.addEventListener('progress', function(evt){
if(evt.lengthComputable){
var percentComplete = evt.loaded / evt.total;
percentComplete = parseInt(percentComplete * 100);
console.log(percentComplete);
// $(Widget).find('.progress').progress('set percent', percentComplete);

if(percentComplete === 100){
//container.find('.progress').hide();
}
}
}, false);
return xhr;
},
url: $(Widget).data('url'),
type: "POST",
data: requestData,
processData: false,
contentType: false,
beforeSend: function(){
$(Widget).addClass('ui form loading');
},
error: function(xhr, textStatus, message){
$(element).removeClass('loading');
alert(textStatus+':'+message);
},
success: function(data, textStatus, xhr){
$(Widget).removeClass('ui form loading');
//$(Widget).append(data);
}
});
}

$.G3.forms.initializeForm = function (Form){
var validationRules = {};

settings.rules.required = function(value){
if(value){
return true;
}else{
return false;
}
};

settings.rules.email = function(value){
if(value.match(/^([a-zA-Z0-9_\.\-\+%])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{1,11})+$/)){
return true;
}else{
return false;
}
};

settings.rules.minChecked = function(value, minChecked){
jQuery(this).closest('.mainfield').off('change.validation').on('change.validation', ':input', function(){
Form.form('validate form');
});

if(jQuery(this).closest('.mainfield').find(':input:checked').length >= minChecked){
return true;
}else{
return false;
}
};

settings.rules.maxChecked = function(value, maxChecked){
jQuery(this).closest('.mainfield').off('change.validation').on('change.validation', ':input', function(){
Form.form('validate form');
});

if(jQuery(this).closest('.mainfield').find(':input:checked').length > maxChecked){
return false;
}else{
return true;
}
};
Max_admin Max_admin 26 Dec, 2020
Answer
no problems here after updating WP!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.