EllisLab text mark
Advanced Search
     
Help with Javascript in EE
Posted: 27 June 2012 03:32 PM   [ Ignore ]
Joined: 2012-06-09
5 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 Thank.s for your help in advance.

Thanks.

 
Posted: 09 July 2012 02:32 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2011-11-25
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,

 Signature 

Recent version: EE 2.5.4 | Forum Module 3.1.10 | MSM 2.1.4 | 2.x Bug Tracker | Version Upgrade

 
Posted: 09 July 2012 02:35 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-06-09
5 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.

 
Posted: 09 July 2012 03:05 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2005-10-18
7340 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'layoutgoogle.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,

 Signature 

How may I help you?

 
Posted: 09 July 2012 03:30 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2012-06-09
5 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.

 
Posted: 11 July 2012 11:27 AM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2008-01-31
4773 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?

 Signature 

Need some help? | Current Versions: EE 2.6.1 // MM 1.2.1

 
Posted: 11 July 2012 11:50 AM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Joined: 2012-06-09
5 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.

 
Posted: 12 July 2012 01:12 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2005-10-18
7340 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,

 Signature 

How may I help you?

 
Posted: 16 July 2012 10:19 AM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2008-01-31
4773 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!

 Signature 

Need some help? | Current Versions: EE 2.6.1 // MM 1.2.1