0

Javascript error in zk.wpd

asked 2011-09-13 16:25:35 +0800

mhongslo gravatar image mhongslo
51 1

Can anyone help determine why ZK is produce a javascript error as follows:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; MS-RTC LM 8)
Timestamp: Tue, 13 Sep 2011 21:07:51 UTC


Message: Invalid argument.
Line: 11036
Char: 29
Code: 0
URI: https://www.mysite.com/zkau/web/e0aaa743/js/zk.wpd


The error appears to be consistent between pages and seems to be produced with ZK 5.0.7 and ZK 5.0.8.

I tried looking at the source code using the URL provided above to request it. So the code looks like so

zk.eff.FullMask = zk.$extends(zk.Object, {
	
	$init: function (opts) {
		opts = zk.$default(opts, _getSKUOpts());
		var mask = this.mask = jq(opts.mask||[], zk)[0];
		if (this.mask) {
			if (opts.anchor)
				opts.anchor.parentNode.insertBefore(mask, opts.anchor);
			if (opts.id) mask.id = opts.id;
			if (opts.zIndex != null) mask.style.zIndex = opts.zIndex;     // THIS IS LINE 11036
			if (opts.visible == false) mask.style.display = 'none';
		} else {
			var maskId = opts.id || 'z_mask',
				html = '<div id="' + maskId + '" class="z-modal-mask"';
			if (opts.zIndex != null || opts.visible == false) {
				html += ' style="';
				if (opts.zIndex != null) html += 'z-index:' + opts.zIndex;
				if (opts.visible == false) html += ';display:none';
				html +='"';
			}

			html += '></div>'
			if (opts.anchor)
				jq(opts.anchor, zk).before(html);
			else
				jq(document.body).append(html);
			mask = this.mask = jq(maskId, zk)[0];
		}
		if (opts.stackup)
			this.stackup = jq.newStackup(mask, mask.id + '-mkstk');

		_syncMaskPos.call(this);

		var f;
		jq(mask).click(jq.Event.stop); 
		jq(window).resize(f = this.proxy(_syncMaskPos))
			.scroll(f);
	},
	
	destroy: function () {
		var mask = this.mask, f;
		jq(mask).unbind("click", jq.Event.stop)
			.remove()
		jq(window).unbind("resize", f = this.proxy(_syncMaskPos))
			.unbind("scroll", f);
		jq(this.stackup).remove();
		this.mask = this.stackup = null;
	},


Any help is appreciated!

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2011-11-29 22:05:02 +0800

mogren gravatar image mogren
102 1

gekkio,
Yes, you're right. That's the wrong syntax. In this particular case, the presence of the old anima stuff was causing a strange javascript error. So the samples are simply to reproduce the javascript error for matthewgo. We don't need the animation, so we just removed it.

Matt

link publish delete flag offensive edit

answered 2011-11-29 20:22:26 +0800

gekkio gravatar image gekkio flag of Finland
899 1
http://gekkio.fi/blog

Isn't that the wrong action syntax?

If you look at the javadoc you'll see that the only actions that are supported are show/hide (not onshow/onhide). Also, the effects in ZK5 are in zk.eff.Actions, not anima.
I'm guessing you are using the old ZK 3.6 syntax that is not supported.

Try this valid ZK5 syntax instead:

action="show: slideDown; hide: slideUp"

It's probably not the effect you want but in ZK5 only four effects are supported anyway.

link publish delete flag offensive edit

answered 2011-11-29 17:22:35 +0800

mogren gravatar image mogren
102 1

matthewgo,

Here's a simple test with the anima stuff in it:

ZKFiddle-Link

TestComposer.java
package ji0pcbo$v10;

import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkoss.zk.ui.util.*;
import org.zkoss.zk.ui.ext.*;
import org.zkoss.zk.au.*;
import org.zkoss.zk.au.out.*;
import org.zkoss.zul.*;

public class TestComposer extends GenericForwardComposer{

private Window helpWindow;

public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);

}

public void onClick$btn(Event e) throws InterruptedException{
((Html) helpWindow.getFellow("help_caption")).setContent("Some dynamic title");
((Html) helpWindow.getFellow("help_text")).setContent("Some dynamic help text.");
try {
helpWindow.doHighlighted();
}
catch (Exception e1) {
}

}
}


index.zul
<zk>
<window apply="ji0pcbo$v10.TestComposer">
<button id="btn" label="Click Me To Test Anima JavaScript error." />
<window id="helpWindow" contentStyle="padding:3px;background-color:rgb(224,224,224);" width="270px" visible="false"
style="border: 2px outset white" action="onshow:anima.appear(#{self});onhide:anima.fade(#{self})"
xmlns:h="http://www.w3.org/1999/xhtml">
<vbox width="100%" style="padding:3px;border:2px">
<hbox width="100%">
<div align="left">
<toolbarbutton image="/images/toolbar/help.gif" />
</div>
<div align="right">
<toolbarbutton image="/images/toolbar/close.gif" onClick="help_window.setVisible(false)" />
</div>
</hbox>
<vbox style="padding:3px" width="100%">
<div align="center" width="100%">
<html id="help_caption" style="font-weight:bolder;font-size:10pt;color:rgb(189,0,0)" height="20px" />
</div>
<html id="help_text" style="overflow:auto;white-space:normal;text-align:justify;" />
<separator spacing="5px" />
</vbox>
</vbox>
</window>
</window>

</zk>

Here's the same test without the anima stuff in it:


TestComposer.java
package j2o52uoc$v3;

import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkoss.zk.ui.util.*;
import org.zkoss.zk.ui.ext.*;
import org.zkoss.zk.au.*;
import org.zkoss.zk.au.out.*;
import org.zkoss.zul.*;

public class TestComposer extends GenericForwardComposer{

private Window helpWindow;

public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);

}

public void onClick$btn(Event e) throws InterruptedException{
((Html) helpWindow.getFellow("help_caption")).setContent("Some dynamic title");
((Html) helpWindow.getFellow("help_text")).setContent("Some dynamic help text.");
try {
helpWindow.doHighlighted();
}
catch (Exception e1) {
}

}
}


index.zul
<zk>
<window apply="j2o52uoc$v3.TestComposer">
<button id="btn" label="Click Me To Test Anima JavaScript error." />
<window id="helpWindow" contentStyle="padding:3px;background-color:rgb(224,224,224);" width="270px" visible="false" closable="true"
style="border: 2px outset white"
xmlns:h="http://www.w3.org/1999/xhtml">
<vbox width="100%" style="padding:3px;border:2px">
<hbox width="100%">
<div align="left">
<toolbarbutton image="/images/toolbar/help.gif" />
</div>
<div align="right">
<toolbarbutton image="/images/toolbar/close.gif" onClick="help_window.setVisible(false)" />
</div>
</hbox>
<vbox style="padding:3px" width="100%">
<div align="center" width="100%">
<html id="help_caption" style="font-weight:bolder;font-size:10pt;color:rgb(189,0,0)" height="20px" />
</div>
<html id="help_text" style="overflow:auto;white-space:normal;text-align:justify;" />
<separator spacing="5px" />
</vbox>
</vbox>
</window>
</window>

</zk>

The test WITH the anima stuff, just sits at the "Processing...". The other quickly gets to a simple page with a button.

Hope that helps,
Matt

link publish delete flag offensive edit

answered 2011-11-28 09:40:19 +0800

matthewgo gravatar image matthewgo
375

@mogren
Would you please provide the sample code that can reproduce the issue on ZK Fiddle?

link publish delete flag offensive edit

answered 2011-11-15 19:54:10 +0800

mogren gravatar image mogren
102 1

I fairly sure that our issue was related to some anima stuff still in one of our files, e.g. onshow:anima.appear(#{self});onhide:anima.fade(#{self}). I don't know why it caused the error to be reported where it did, but when we removed the anima stuff the issue went away.

I hope I haven't hijacked this thread with a completely different issue.

link publish delete flag offensive edit

answered 2011-11-02 23:40:17 +0800

mogren gravatar image mogren
102 1

I'm experiencing a similar error with version 5.0.9, except mine is reported at line 25. If I simply change the version to 5.0.5, everything works again.

link publish delete flag offensive edit

answered 2011-09-14 20:38:53 +0800

matthewgo gravatar image matthewgo
375

Hi
Can u provide sample code to reproduce issue?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-09-13 16:25:35 +0800

Seen: 601 times

Last updated: Nov 29 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More