• Resolved cdechery

    (@cdechery)


    I have a site, in which I have the first page using some PHP and javascript code of my own. For the PHP part I got Exec-PHP working perfectly. The problem starts with the Javascript portion.

    In my post I simply have:

    <?php
    include("whatever.php");
    ?>

    Inside whatever.php I have some javascript code to dynamically update a form and validate it. Problem is, the javascript code is getting “messed with” by WP. It adds HTML tags, and it converts characters to HTML codes, rendering it useless.

    I tried using Text Control, no use.
    I tried activating Multi-site, thus enabling unfiltered-html, no use.

    I’m about to quit WP for good if I can’t run a simple javascript validation on my form. How hard can this be?

    Please help! thanks

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

    (@cdechery)

    GOT IT! Amazing how stuff simply “solves itself” the minute you are about to quit! This happened to my a hundred times in my developer career.

    Well, I don’t know if unfiltered-html is needed or not, but the trick was:
    1) Enable Text Control
    2) In the post where u have the javascript code, use No formatting, and No character encoding
    3) Put all the functions, and preferably MOST of the code in a .js file, and include it in the header.php of the template, inside the HEAD section, like this:

    ...
    <script type="text/javascript" language="javascript" src="/casorio.js"></script>
    </head>

    Maybe it won’t work, but keep trying. I just spent 3h trying to figure this one out, and eventually it worked! =)

Viewing 1 replies (of 1 total)
  • The topic ‘Impossible to get Javascript working – help!!’ is closed to new replies.