Home Forums Newsletter Plugin Support Javascript validation code doubled

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #15186
    MKJ
    Participant

    Hi,
    I use Newsletter 3.6.7 with WP 4.1. When I activate the Newsletter widget the javascript validation code is doubled in the source code like so:

    		</aside><aside id="newsletterwidget-3" class="widget widget_newsletterwidget"><h3 class="widget-title"><span>News & Aktionen per Email</span></h3>
    
    <script type="text/javascript">
    //<![CDATA[
    if (typeof newsletter_check !== "function") {
    window.newsletter_check = function (f) {
        var re = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-]{1,})+\.)+([a-zA-Z0-9]{2,})+$/;
        if (!re.test(f.elements["ne"].value)) {
            alert("Ist die Email richtig?");
            return false;
        }
        if (f.elements["ny"] && !f.elements["ny"].checked) {
            alert("You must accept the privacy statement");
            return false;
        }
        return true;
    }
    }
    //]]>
    </script>
    
    <div class="newsletter newsletter-widget">
    
    <script type="text/javascript">
    //<![CDATA[
    if (typeof newsletter_check !== "function") {
    window.newsletter_check = function (f) {
        var re = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-]{1,})+\.)+([a-zA-Z0-9]{2,})+$/;
        if (!re.test(f.elements["ne"].value)) {
            alert("Ist die Email richtig?");
            return false;
        }
        if (f.elements["ny"] && !f.elements["ny"].checked) {
            alert("You must accept the privacy statement");
            return false;
        }
        return true;
    }
    }
    //]]>
    </script>

    Not a big deal. However, I would prefer to have this code only once.

    #15187
    Stefano
    Keymaster

    There is a check in the code:

    if (typeof newsletter_check !== "function") {

    so it does not create problem. I’ll add a global injection status anyway, thank you.

    #15188
    MKJ
    Participant

    OK, thank you very much.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.