Forums

Posting in these forums is disabled. These forums will be available for archive purposes. Please join the new forums at the links below:

  • yui-support - replaces the `YUI 3.x` and `YUI 3 Gallery` forums.
    We have created the following discussion categories within this group to aid discoverability for these most-used topics:
    • Charts for YUI Charts support.
    • DataTable for YUI DataTable support.
    • Gallery for YUI Gallery support, including support for published Gallery components as well as the Gallery process in general.
    • Tools for support of YUI’s suite of developer tools such as selleck, shifter, grover, yogi, etc.
    • Everything Else for questions that don’t fit one of the categories above, we’ve got you covered here.
  • yui-deprecated - replaces the `YUI 2.x` forum and the forums of other deprecated products (`YUI Doc`, `Builder`, `YUI PHP Loader`, etc.).
  [ 11 posts ] Go to page 1, 2 Next
New Topic | Post Reply | Print view
Previous topic | Next topic

Tripp Martin

  • Username: trippmartin
  • Joined: Mon Aug 30, 2010 11:47 am
  • Posts: 5
  • Offline
  • Profile
Tags:
  • button
  • firefox
  • ie7
  • tabview

JavaScript functions not executed

Post Posted: Mon Aug 30, 2010 12:19 pm
+0-
I'm creating a TabView and using the Dispatcher to retrieve the content of each tab. The content comes in fine and displays correctly in FireFox as well as IE7 but the JavaScript functions included do not appear to be available in IE7. In the retrieved content I have a button that executes a JavaScript function using the onclick of the button. Selecting the button in FireFox does what it should - executes and submits the form. In IE7 though, selecting the button does nothing (not even an error message). Am I doing something wrong?

I'm using the version of the Dispatcher that I retrieved from caridy.name on http://yuilibrary.com/forum/viewtopic.php@f=134&t=4732

Code:
var tabview = new Y.TabView();

tabview.add({
   label: 'General'
});

(new Y.Dispatcher ({
   node: tabview._items[0].get('panelNode'),
   content: 'loading...',
   normalize: true
})).set ('uri', 'http://sample.com/script');


To rule out my code that's being fed in, I created a simple HTML file to be pulled into the tab that just has a button that executes a JavaScript function with an alert call. Nothing happens in IE7 when I select the button.

Code:
<html>
<head>
<script language="javascript">
function test() { alert('test'); }
</script>
</head>
<body>
<input type="button" value="click me" onclick="test();">
</body>
</html>


Thanks in advance!

Caridy Patino

YUI Contributor

  • Username: caridy
  • Joined: Mon Dec 08, 2008 5:40 pm
  • Posts: 494
  • Location: Miami, FL
  • Twitter: caridy
  • GitHub: caridy
  • Gists: caridy
  • IRC: caridy
  • YUI Developer
  • Offline
  • Profile
Tags:
  • dispatcher
  • fragment
  • bug
  • ie

Re: JavaScript functions not executed

Post Posted: Tue Aug 31, 2010 7:23 am
+0-
Hey Tripp, I will look into this today. I noticed some weird behavior in IE when you have a single tag (like the input) in the body of the page. Maybe that's the problem. Anyway, I will look into it, and I will let you know.

Best Regards,
Caridy

Rob

  • Username: therob
  • Joined: Tue Aug 31, 2010 8:49 am
  • Posts: 8
  • Offline
  • Profile

Re: JavaScript functions not executed

Post Posted: Tue Aug 31, 2010 9:40 am
+0-
Try removing the ";" from onClick.

Code:
<input type="button" value="click me" onclick="test()">

Tripp Martin

  • Username: trippmartin
  • Joined: Mon Aug 30, 2010 11:47 am
  • Posts: 5
  • Offline
  • Profile

Re: JavaScript functions not executed

Post Posted: Tue Aug 31, 2010 9:56 am
+0-
Taking the semicolon out doesn't help. I should also note that my original page I'm feeding into the tab has several JavaScript functions and more HTML code. I just created that little HTML page to see if it was anything in my page that was causing the problem. Since I still couldn't get the function to execute with the HTML I posted I thought it might be something going wrong in the dispatcher.

Rob

  • Username: therob
  • Joined: Tue Aug 31, 2010 8:49 am
  • Posts: 8
  • Offline
  • Profile
Tags:
  • ie7

Re: JavaScript functions not executed

Post Posted: Tue Aug 31, 2010 10:20 am
+0-
I just tested this in IE7, it seems that IE blocks the script from running in the default security setting. It popped up and asked if I wanted to allow blocked content, when I hit allow for it, the function worked fine,

Tripp Martin

  • Username: trippmartin
  • Joined: Mon Aug 30, 2010 11:47 am
  • Posts: 5
  • Offline
  • Profile
Tags:
  • button

Re: JavaScript functions not executed

Post Posted: Tue Aug 31, 2010 11:24 am
+0-
That's strange. I set my security settings to Medium-Low (even tried Low) and I get no pop-up or anything. The button just appears to do nothing.

Can you post the code you used? Maybe I'm doing something else wrong.

shhQuiet

  • Joined: Thu Jul 29, 2010 2:23 pm
  • Posts: 9
  • Offline
  • Profile
Tags:
  • firefox jslint

Re: JavaScript functions not executed

Post Posted: Tue Aug 31, 2010 12:13 pm
+0-
Does your code pass JSLint? Firefox is much more tolerant of bad JS than IE...

Rob

  • Username: therob
  • Joined: Tue Aug 31, 2010 8:49 am
  • Posts: 8
  • Offline
  • Profile

Re: JavaScript functions not executed

Post Posted: Tue Aug 31, 2010 12:59 pm
+0-
I used the same exact code you posted with out the ";". The message that pops up is a bar at the top of the page that states "To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Click here for options..."

Caridy Patino

YUI Contributor

  • Username: caridy
  • Joined: Mon Dec 08, 2008 5:40 pm
  • Posts: 494
  • Location: Miami, FL
  • Twitter: caridy
  • GitHub: caridy
  • Gists: caridy
  • IRC: caridy
  • YUI Developer
  • Offline
  • Profile
Tags:
  • ie7
  • dispatcher
  • test
  • security

Re: JavaScript functions not executed

Post Posted: Tue Aug 31, 2010 2:11 pm
+0-
Oh, this has become a very interesting thread, this security notification never happens to me before.

Can you guys run dispatcher tests on your IE7? Here is the link
http://caridy.name/sandbox/yui3-gallery ... tcher.html

Let me know the result.

Best Regards,
Caridy

Tripp Martin

  • Username: trippmartin
  • Joined: Mon Aug 30, 2010 11:47 am
  • Posts: 5
  • Offline
  • Profile
Tags:
  • ie7

Re: JavaScript functions not executed

Post Posted: Tue Aug 31, 2010 4:51 pm
+0-
Everything passed in my IE7.

So I decided to install the IE Tab 2 add-on for Firefox to see if maybe I could get some more information on what was going on. After loading the page in a FireFox IE tab, I actually got an error message! The error message was related to the fact that the button was trying to execute a JS function but the function wasn't available. So, I tried moving the JavaScript function into the parent code to see what would happen. After moving the JavaScript function to the parent, the button works as expected.

It's as if the function defined in the code being run through the dispatcher isn't being registered.

Tripp
  [ 11 posts ] Go to page 1, 2 Next
New Topic | Post Reply | Print view
Previous topic | Next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum