• Resolved pkiula

    (@pkiula)


    We need to cloak the fact that that we use WP. And we’re fanatic about website performance, with clients requirining > 95 score on Pingdom etc.

    As such, the bunch of JS crap that WPForms adds in the wp_footer() function call is not possible for us:

    
    <script type='text/javascript' src='https://DOMAIN.NET/wp-content/plugins/wpforms-lite/assets/js/jquery.validate.min.js?ver=1.19.3' id='wpforms-validation-js'></script>
    <script type='text/javascript' src='https://DOMAIN.NET/wp-content/plugins/wpforms-lite/assets/js/mailcheck.min.js?ver=1.1.2' id='wpforms-mailcheck-js'></script>
    <script type='text/javascript' src='https://DOMAIN.NET/wp-content/plugins/wpforms-lite/assets/js/punycode.min.js?ver=1.0.0' id='wpforms-punycode-js'></script>
    <script type='text/javascript' src='https://DOMAIN.NET/wp-content/plugins/wpforms-lite/assets/js/wpforms.min.js?ver=1.7.3' id='wpforms-js'></script>
    <script>
    ( function() {
    	function wpforms_js_error_loading() {
    
    		if ( typeof window.wpforms !== 'undefined' ) {
    			return;
    		}
    
    		var forms = document.querySelectorAll( '.wpforms-form' );
    
    		if ( ! forms.length ) {
    			return;
    		}
    
    		var error = document.createElement( 'div' );
    
    		error.classList.add( 'wpforms-error-container' );
    		error.innerHTML = '注意してください! WPForms は、このページで JavaScript の問題を検出しました。このフォームが正しく機能するには JavaScript が必要であるため、このフォームは期待どおりに機能しない可能性があります。詳細については<a href="https://wpforms.com/docs/getting-support-wpforms/" target="_blank" rel="noopener noreferrer">トラブルシューティングガイド</a>を参照するか、サポートにお問い合わせください。<p>このメッセージは、サイト管理者にのみ表示されます。</p>';
    
    		forms.forEach( function( form ) {
    
    			if ( ! form.querySelector( '.wpforms-error-container' ) ) {
    				form.insertBefore( error.cloneNode( true ), form.firstChild );
    			}
    		} );
    	};
    
    	if ( document.readyState === 'loading' ) {
    		document.addEventListener( 'DOMContentLoaded', wpforms_js_error_loading );
    	} else {
    		wpforms_js_error_loading();
    	}
    }() );
    </script>
    <script type='text/javascript'>
    /* <![CDATA[ */
    var wpforms_settings = {"val_required":"This field is required.","val_email":"Please enter a valid email address.","val_email_suggestion":"Did you mean {suggestion}?","val_email_suggestion_title":"\u30af\u30ea\u30c3\u30af\u3057\u3066\u3053\u306e\u63d0\u6848\u3092\u53d7\u3051\u5165\u308c\u307e\u3059\u3002","val_email_restricted":"This email address is not allowed.","val_number":"Please enter a valid number.","val_number_positive":"Please enter a valid positive number.","val_confirm":"Field values do not match.","val_checklimit":"You have exceeded the number of allowed selections: {#}.","val_limit_characters":"Limit is {limit} characters. Characters remaining: {remaining}.","val_limit_words":"Limit is {limit} words. Words remaining: {remaining}.","val_recaptcha_fail_msg":"reCAPTCHA verification failed, please try again later.","val_empty_blanks":"Please fill out all blanks.","uuid_cookie":"","locale":"en","wpforms_plugin_url":"http:\/\/DOMAIN.NET\/wp-content\/plugins\/wpforms-lite\/","gdpr":"","ajaxurl":"http:\/\/DOMAIN.NET\/wp-admin\/admin-ajax.php","mailcheck_enabled":"1","mailcheck_domains":[],"mailcheck_toplevel_domains":["dev"],"is_ssl":""}
    /* ]]> */
    </script>
    

    Which portions of this junk drawer is absolutely required by WPForms to work well? We literally have a two field Constant Contact newsletter signup form, in our sidebar.php, which we’d like to submit in-place (ajax submission).

    Could you please advise how we lose all the JQuery crap etc.

    Thanks

    • This topic was modified 2 years, 11 months ago by pkiula.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @pkiula,

    Sorry about the trouble you are facing here due to this odd issue here.

    I have reached out to my developers to get more insights on this and will get back to you soon with an update here!

    Thank you for your patience here.

    Thread Starter pkiula

    (@pkiula)

    Thank you.

    If this kind of Jquery etc are required for WP Forms (which would make it a non-starter for any performance oriented website, which should be all of them), then my next question would be: is it possible to open a form designed by WP Forms inside a modal window or lightbox? Then submit the form via AJAX within the modal… without reloading the entire page? DOn’t mind doing this inside an iframe inside the modal.

    Please check with the developers for any ideas. We cannot have 6 additional JS files for *every* visitor on our website. We will need to find a way to conditionally include WP Forms code only when a user wants to fill the form… for example, while signing up for Constant Contact newsletters.

    Many thanks.

    Thread Starter pkiula

    (@pkiula)

    Any thoughts?

    Hey @pkiula,

    Thanks for following on this thread, and I apologize for the delay in getting back to your support request.

    I checked with our developers, and all those scripts that are shown are going to be required. WPForms will enqueue only the scripts it needs based on what’s on the form so it won’t randomly enqueue the conditional logic script if no fields use conditional logic and it’s pretty optimized in that sense. Yes, it’s an additional network request but it’s not an external request and all of the files are on the server so it should be pretty efficient/quick and I don’t see that causing any major performance impact. In this case, since you have an email field, you’re going to need the mailcheck and punycode scripts to validate the email field and the jquery validate script for all the other validation and finally the wpforms.min.js file as the brains of the form. As for the second question about using a modal window, that should work fine but I guess it depends on what modal/lightbox library you’re using.

    Though we keep on testing for compatibility with all of the modal/lightbox libraries out there, however, we haven’t tested for all the lightbox so you would simply need to test this.

    Kindly,

    Hey @pkiula,

    We haven’t heard back from you in about a week, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Which basic JS files to include?’ is closed to new replies.