Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • mc2prod

    (@mc2prod)

    @noez_design

    This code goes into any custom javascript file or you can load it in your child themes footer via <script></script> tags but not in the functions.php

    jQuery( document ).ready(function() {
       // If file upload field is empty: remove. Otherwise it will not submit in Safari 11.1.1
    	jQuery(".wpcf7-submit").on('click', function(){
    	     //alert("Clicked");
    	    jQuery("input[type=file]").each(function() {
    		if(jQuery(this).val() === "") {
    		  //alert(jQuery(this).attr("name"));
    		  jQuery(this).prop('disabled', true);	    
    		}
    	    });
            })
    });

    A little late, but this is how I solved it:

    // If file upload field is empty: remove. Otherwise it will not submit in Safari 11.1.1
    	jQuery(".wpcf7-submit").on('click', function(){
    	     //alert("Clicked");
    	    jQuery("input[type=file]").each(function() {
    		if(jQuery(this).val() === "") {
    		  //alert(jQuery(this).attr("name"));
    		  jQuery(this).prop('disabled', true);	    
    		}
    	    });
            })

    The reason cf7 dom related (document.addEventListener( ‘wpcf7submit’, function( event )) does not work is it fires after ajax submission. You need to do your work before ajax submission. I used the above function in when dom ready. Use this when you absolutely need file input.

    • This reply was modified 6 years, 3 months ago by mc2prod.

    I can confirm this issue posted by mattvd. I have been unable to use this plugin because of the issue above. I have reinstalled several different times over the past months.

Viewing 3 replies - 1 through 3 (of 3 total)