• Hi,

    We’re experiencing an issue with forms on our WordPress website using the official MailPlus Forms plugin.

    Issue
    Sometimes the validation script (jquery.validate.min.js) is not loaded (or not loaded in time). When this happens:

    • A math question (e.g. “4 + 4”) briefly appears in the form and disappears

    Findings

    • When the script https://static.mailplus.nl/jq/jquery.validate.min.js is blocked or delayed, the issue consistently reproduces
    • This suggests the form is rendered/usable before all required validation scripts are fully loaded

    Expected behavior
    The form should not be submittable (or fully initialized) until all required scripts, including validation, are properly loaded and ready.

    Request
    Could you investigate why the validation script is not reliably loaded or initialized? Ideally, the plugin should:

    • Ensure required scripts are always loaded before the form becomes interactive
    • Gracefully handle delayed script loading without breaking validation

    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter yvett

    (@yvett)

    After digging into the plugin code, found two bugs in frontend/classes/Shortcode.class.php:

    Bug 1: Missing script dependencies

    spotler-form-additions is registered with an empty dependency array, so WordPress doesn’t wait for jquery-validate before running it. Fix:

    wp_enqueue_script(
    ‘spotler-form-additions’,
    SPOTLER_PLUGIN_URL . ‘public/js/form_additions.js’,
    [‘jquery’, ‘jquery-validate’], // was []
    filemtime( SPOTLER_PLUGIN_DIR . ‘public/js/form_additions.js’ )
    );

    Bug 2: External CDN, no fallback

    wp_enqueue_script( 'jquery-validate', '//static.mailplus.nl/jq/jquery.validate.min.js', … );

    If static.mailplus.nl is slow or blocked, the whole form breaks. jquery.validate.min.js is MIT licensed. You could bundle it inside the plugin and load it locally to remove this dependency.

    And why the math question flashes: form_additions.js fires an AJAX call on document.ready to refresh the security question. When validation isn’t initialized, the form’s own init script never runs, so the raw math label briefly appears before AJAX replaces it. Bug 1 is the direct cause.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.