ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Help with Javascript in EE

June 27, 2012 3:32pm

Subscribe [2]
  • #1 / Jun 27, 2012 3:32pm

    EI Tech

    3 posts

    Hi,

    I have expression engine 1.6.3 installation. I am not able to run ANY javascript from the website. Here is one example of the script (http://pastie.org/4227005)

    I am inserting this in one of the weblogs. You can see the site at http://www.eitek.com. Thanks for your help in advance.

    Thanks.

  • #2 / Jul 09, 2012 2:32pm

    Shane Eckert

    7174 posts

    Hey EI Tech,

    I am sorry to hear you are running into this problem.

    This is a tad outside of support as it deals with JavaScript. I am going to move this over to Community Help where I am sure you will get some great advice on getting your JS to work.

    Cheers,

  • #3 / Jul 09, 2012 2:35pm

    EI Tech

    3 posts

    Shane,
    You have helped very similar thread before. I am not sure how thsi is outside of support. Please talk with Kevin Smith as he had assuerd me that you will take care of this.

  • #4 / Jul 09, 2012 3:05pm

    Dan Decker

    7338 posts

    Hey EI Tech,

    All apologies on moving this prematurely!

    After looking it over and talking to Shane about the way ExpressionEngine handle in-line JavaScript, we figured out (hopefully) what the hiccup here.

    Trey this for us, OK?

    function googleTranslateElementInit() {
      new google.translate.TranslateElement({
    pageLanguage: 'en', layout: google.translate.TranslateElement.FloatPosition.TOP_RIGHT
    }, 'google_translate_element');
    }

    The line breaks around the “{}” pair in your JavaScript function attributes are the key.

    More often than not, when ExpressionEngine sees anything between the 2 braces on the same line, it wants to parse them as EE tags, and breaks JS like this. Generally, breaking them up across multiple lines will prevent EE from trying to do that.

    Let me know if that doesn’t square this up.

    Cheers,

  • #5 / Jul 09, 2012 3:30pm

    EI Tech

    3 posts

    Hi Dan,

    I tried that but it is still having some issues. Please see http://www.eitek.com/products/wastewater-dss/ Result is a blank rectangle at the bottom of the page. I have tested the same JS before with our other Non EE sites and I know it does work.

    Thanks.

  • #6 / Jul 11, 2012 11:27am

    Kevin Smith

    4784 posts

    Hey EI Tech,

    Could you give us a fuller context for where this JS is being used? If you could copy that whole template to Pastie and post the link back here, that would be fantastic.

    The other thing I would point out is that upon inspection of the blank rectangle, I’m seeing all references point to a Microsoft technology, whereas above you posted a snippet of JS from Google. Are you sure you’re looking at the right thing?

  • #7 / Jul 11, 2012 11:50am

    EI Tech

    3 posts

    Hi Kevin,
    Since Google code did not work, I thought we will try Microsoft code and still had same problem. Pastie does not let me paste the code (says it appears you are a bot) but you can “view source” on the page above and see the Javascript code I inserted starting line 172.
    Please let me know.
    Thanks.

  • #8 / Jul 12, 2012 1:12pm

    Dan Decker

    7338 posts

    Hi EI Tech,

    Are you placing the js directly in the template or as part of a channel entry?

    It’s just odd that other scripts are working just fine…

    I’d like to see what’s going on here, be on the lookout for an email from EllisLab.

    Cheers,

  • #9 / Jul 16, 2012 10:19am

    Kevin Smith

    4784 posts

    Just posting a note here to let onlookers know that we’re working with EI Tech privately on this for the time being. I’ll post an update back here once we have something to share!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases