WordPress.org

Ready to get started?Download WordPress

Forums

Script works in preview & breaks when published? (8 posts)

  1. melanaster
    Member
    Posted 4 years ago #

    This has been driving me bonkers - here we go.

    I have a script that generates a form on my blog where people can submit their email addresses for a mailing list.

    My problem is this : when I'm creating a post and I paste the script into the HTML in the WP editor and click "Preview," the page looks fine. But when I actually Publish the page, the script breaks and leaves an error displayed instead of the form.

    Another interesting thing to note is that the script seems to break only in the individual post. Like, if I have all of my blog posts displayed on the home page, the form displays fine. But if I navigate to the individual post (via a permalink), the form is broken. Any ideas?

  2. Robert S
    Member
    Posted 4 years ago #

    @melanaster,

    What sort of script are we talking about?

    PHP, javascript, html ?

    R

  3. melanaster
    Member
    Posted 4 years ago #

    It's a PHP script. I'm pretty sure my web guy built it using the CoffeeCup form builder. This may help - here's the code for the script :

    <script src="swfobject.js" type="text/javascript"></script>
    <div id="CC7444629">OOPS! You forgot to upload swfobject.js ! You must upload this file for your form to work.</div>
    <script type="text/javascript">// <![CDATA[
    var so = new SWFObject("emailsubmit.swf", "emailsubmit.xml", "485", "83", "7,0,0,0", "#ffffff");so.addParam("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");so.addParam("quality", "high");so.addParam("scale", "noscale");so.addParam("salign", "lt");so.addParam("FlashVars", "xmlfile=emailsubmit.xml&w=485&h=83");so.write("CC7444629");
    // ]]></script>

  4. melanaster
    Member
    Posted 4 years ago #

    Sorry, obviously that's a Javascript object. Kind of tired.

  5. melanaster
    Member
    Posted 4 years ago #

    Here's a demonstration of the problem :

    http://marleycarroll.com/blog/ - first post looks good, email submission script displays fine.

    http://marleycarroll.com/blog/art/new-release-marley-carroll-the-remixes-3.html (permalink for the first post) - email submission script is broken.

  6. Robert S
    Member
    Posted 4 years ago #

    @melanaster,

    Have you checked this article in the codex?

    http://codex.wordpress.org/Using_Javascript#Javascript_in_Posts

    R

  7. melanaster
    Member
    Posted 4 years ago #

    Wow, that codex article looks very helpful. I can't yet figure out what I'm doing wrong, but I'll pass it along to my web guru when the time comes. I think somewhere in there is the answer I need, especially the part about Javascripts in posts. I have a lot to learn =)

  8. Robert S
    Member
    Posted 4 years ago #

    @melanaster,

    Although I know little about javascript myself - I'm happy to have been of some assistance.

    Good luck!

    R

Topic Closed

This topic has been closed to new replies.

About this Topic