I’d like to avoid using the twig “{{lead.firstname}}” etc to populate the form fields with the existing data if possible.
add_filter('integration-cds/forms/fields','my_icds_filter_function',1);
]]>Due to GDRP and our on-site storage policy, we don’t want to store submitted data to the local wordpress database (the message list). Is it possible to turn this of? Or somehow just post empty data via a filter?
Thanks!
]]>This creates a false positive on the checks for FormData existence in the Submit callbacks for mobile Safari as recently as iOS 10, and triggers the standard POST fallback rather than the usual AJAX submission.
A potential fix has been outlined here:
https://www.ads-software.com/support/topic/when-submitting-a-form-it-reloads-the-page-completly-in-safari/#post-9555439
Changing from typeof window.FormData !== "function"
to typeof window.FormData === "undefined"
on lines 49 and 188 of includes/js/scripts.js confirmed working in Browserstack iOS 7 Safari.
wpcf7.initForm
and wpcf7.submit
functions:
if ( typeof window.FormData !== 'function' ) {
return;
}
It was a weird error that the function only returned only in Safari <=9.1. I have found out that, typeof window.FormData
is function
in Safari >= 10 while in Safari <=9.1, it is equal to object
. A possible fix that I have implemented for our website was the following:
if ( typeof window.FormData === 'undefined' ) {
return;
}
Could you please solve this problem; so that, it works in older versions of Safari.
]]>For an event website I need to grab new speakers profile images – along their company data.
They usually will attach profile images in various shapes and sizes and there is a lot of work to do after we receive their images, cropping all of them to a standard dimension.
To solve this problem, I’ve implemented a javascript solution which allow them to crop their profile image to a standard dimension before submitting the form. They use the tool I’ve embedded in CF7 – they crop their profile image – then from html5 <canvas> element I get the correct image blob and I show the cropped picture. The next step is to attach my image blob to the mail using new CF7 adopted FormData.
my blob how it looks in console : blob:https://localhost/31a63fc2-164c-4527-bcf9-ebe1612b645d1
in CF7 scripts.js under wpcf7.submit function (around line 190), I’ve created the blob to be attached
var nBlob = new Blob([croppedBlob], {type : “image/png”, name:croppedBlobName});
(in console looks like this : [object Blob])
however, I got a message error in console : TypeError: data is null;
which is coming from ajaxSuccess function (Scripts.js line 219) – specifically is stops on this line : id: $( data.into ).attr( ‘id’ )…
Therefore on submit anyway my object is not sent as attachment.
So the real question is – how we (CF7 users) can send blob objects with contact form 7 – which is the correct procedure ? can we use a WP hook for this case ? or should I save the blob as image locally on a folder (where CF7 can look for .. ) then attach the image to the form ?
]]>// detect file upload type
$('#cvfiles').change(function(event) {
var uploadData = $(this).val();
var extType = uploadData.split('.').pop();
if (extType == "txt") {
console.log('txt file found');
readBlobTxt();
} else if (extType == "docx") {
data = new FormData();
data.append( 'cvfiles', $( '#cvfiles' )[0].files[0] );
$.ajax({
url: "https://localhost/wp/wp-content/themes/twentyfourteen/inc/ajax_php_file_rename.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: data,
contentType: false, // The content type used when sending data to the server.
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
console.log(FormData);
console.log('success');
// run scan function file
var fileLocal = 'https://localhost/wp/wp-content/themes/twentyfourteen/inc/uploads/' + uploadData;
$.get('readfile.php?fileUrl=' + fileLocal, function(data) {
console.log('Load was performed.');
document.getElementById('cv-content').textContent = data;
scanPortfolioDocX();
});
}
});
} else if (extType == "doc") {
// stuff here
} else if (extType == "pdf") {
// stuff here
} else {
console.log('other file found');
}
});
ajax_php_file_rename code below:-
<?php
$UploadDirectory = 'https://localhost/wp/wp-content/themes/twentyfourteen/inc/uploads/'; // upload directory
$File_Name = strtolower($_FILES['cvfiles']['name']);
$FileName_No_Ext = var_dump(basename($File_Name, '.docx'));
$File_Ext = substr($File_Name, strrpos($File_Name, '.')); //get file extention
$Random_Number = rand(0, 9999999999); //Random number to be added to name.
$NewFileName = $FileName_No_Ext.$Random_Number.$File_Ext; //new file name
if(move_uploaded_file($_FILES['cvfiles']['tmp_name'], $UploadDirectory.$File_Name ))
{
// do other stuff
die('Success! File Uploaded.');
}else{
die('error uploading File!');
}
?>
sorry cant add a link as site is still on localhost.
Thanks
https://www.campbellhoffman.com/question/putting-submission-data-on-a-post-or-page/
Many thanks,
Erik
https://www.ads-software.com/plugins/wordpress-form-manager/
]]>