• Resolved ramdamnest

    (@ramdamnest)


    Hi,

    I use Tribulant Newsletters Pro 4.5.6.2 on WordPress 4.4.1.

    I’ve just noticed today while investigating SSL deployment, that the javascript code that goes with the subscription form shortcode causes an error in browser (seen it in Safari, Firefox and Chrome):

    in Chrome: “Uncaught SyntaxError: Unexpected token <“
    in Firefox: SyntaxError: expected expression, got ‘<‘
    in Safari: SyntaxError: Unexpected token ‘<‘

    The code snippet that’s been highlighted is the first line after <script> :

    <p><script type="text/javascript">
    jQuery(document).ready(function() {</p>
    <p>	if (jQuery.isFunction(jQuery.fn.select2)) {
    		jQuery('.newsletters select').select2();
    	}</p>
    <p>	jQuery('input:not(:button,:submit),textarea,select').focus(function(element) {
    		jQuery(this).removeClass('wpmlfielderror').nextAll('div.newsletters-field-error').slideUp();
    	});</p>
    <p>	jQuery('.newsletters-management .newsletters-fieldholder, .entry-content .newsletters-fieldholder, .post-entry .newsletters-fieldholder, .entry .newsletters-fieldholder').addClass('col-md-6');
    });
    </script>

    the form is added with shortcode:
    [newsletters_subscribe list=”6″]

    and the error only appear on pages that has this shortcode.

    Thanks
    R.

    https://www.ads-software.com/plugins/newsletters-lite/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tribulant Software

    (@contrid)

    @ramdamnest

    Thank you for your post.

    It seems like paragraph <p> tags are inserted into the Javascript by the theme.

    Some themes support putting RAW tags around the shortcode to not format it. Can you please edit the Manage Subscriptions page and put [raw]...[/raw] tags around the shortcode to see if that resolves it?

    If not, can you please ask the theme author/developer how you can turn off the formatting of content inside posts/pages automatically so that it doesn’t break shortcodes?

    I look forward to your response.

    Thread Starter ramdamnest

    (@ramdamnest)

    Hi, thank you for your reply.

    I have my web site deployed on a staging environment where wordpress version, newsletter version and theme version are the same but the problem does not occur.
    The plugins installed and their version differs, so I think it’s probably another plugin doing it.

    Regards
    R

    Plugin Author Tribulant Software

    (@contrid)

    Thanks for the information.

    Did you find the problematic plugin or theme causing the issue?

    And did the [raw] tags do anything?

    Thread Starter ramdamnest

    (@ramdamnest)

    Hi.

    I’ve traced the problem down to the premium theme I was using.
    It uses a custom post type called “chunk” that’s meant to hold content snippets that can be re-used many times on pages using a shortcode to include them.

    When including the [newsletters_subscribe list=”6″] shortcode in one one of these CPT, it results in paragraph tags added to the javascript code.
    Using [raw] around the [newsletters_subscribe] shortcode didn’t work as [raw] wasn’t detected as a shortcode.

    I moved the [newsletters_subscribe] shortcode on a Page and no paragraph tags were added to the javascript so the error didn’t happen (but [raw] is still not detected as shortcode on a Page).

    Plugin Author Tribulant Software

    (@contrid)

    I’m glad to hear that you found the problem.

    Enjoy our Newsletter plugin and let us know if you need further assistance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Javascript error with the subscription form’ is closed to new replies.