0

Javascript inclusion in zul file

asked 2006-04-19 11:57:49 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3693846

By: nobody

hi -
i need to include js in my ZUL file. What are the possibilities. I have read some posting here but unfortunately it does not work for me. In my zul file i have tries following:

<h:script src="javascripts/effects.js" type="text/javascript"></h:script>

I put that in the follwing section of zul file:

<window xmlns:h="http://www.w3.org/1999/xhtml" title="ACM 2.0"
border="normal">
<vbox>
<html>
<attribute name="content"><![CDATA[
<head>
<h:script src="javascripts/effects.js" type="text/javascript"></h:script>
</head>
]]></attribute>
</html>
...

It does not work. What am I doing wrong...

Thanks

delete flag offensive retag edit

11 Replies

Sort by ยป oldest newest

answered 2006-04-19 13:51:34 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3694023

By: henrichen

If you put the javascript in <html> tag then you don't have to specify the h:
namespace. If you mix them with other zul tag then you need to specify that
h: namespace.

<window xmlns:h="http://www.w3.org/1999/xhtml" title="ACM 2.0" border="normal"> <vbox> <html> <attribute name="content"><![CDATA[ <head> <script src="javascripts/effects.js" type="text/javascript"></script> </head> ]]></attribute> </html> ...

link publish delete flag offensive edit

answered 2006-04-19 15:59:32 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3694453

By: nobody

hi henri,
putting a namespace is optional. but having it there should not stop to work.
i have tried without and it does not work. I checked the page source and saw the following. it has two head section... which is wrong. second one is what i have included in html section. can you please give some more pointers.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>

<link rel="stylesheet" type="text/css"
href="/acmng-0_0_1/zkau/web/zul/css/normmoz.css.dsp;jsessionid=19A1C8188A1349D00
9077FC1FC2604D1"/>
</head>
<body>
...
...
<div width="100%" id="_pc3!chdextr" class="vbox">

<span id="_pc3">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="javascripts/prototype.js" type="text/javascript"></script>

<script src="javascripts/effects.js" type="text/javascript"></script>
<script src="javascripts/combo.js" type="text/javascript"></script>
</head>

</span></div>
...

link publish delete flag offensive edit

answered 2006-04-20 02:20:26 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3695312

By: henrichen

The zul <html> component is an insertion point that you can put ANY HTML tag in there. Here you put <head> there so ZK just do what you want it to do. I mean, the zul <html> component is not the HTML <html> tag. It is only a convenient way for you to mix zul with HTML tags.

In your example, can't the following work for you?

<window xmlns:h="http://www.w3.org/1999/xhtml" title="ACM 2.0" border="normal">

<h:script src="javascripts/effects.js" type="text/javascript"/> ...

/henri

link publish delete flag offensive edit

answered 2006-04-20 19:32:49 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3696492

By: nobody

hi henry,

is this correct way to call javascript.

<h:a href="javascript:Effect.Combo('content', {duration: 1, scaleX: true,
scaleContent: true});">About</h:a>

i am getting a javascript error saying something like method is not supported...
it worked for me in my jsp page.

link publish delete flag offensive edit

answered 2006-04-21 03:04:46 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3696950

By: henrichen

The way looks ok to me. Is the js function (Effect.Combo) from a js library?
If so, is it possible to give me the source file so I can check it here. Thanks.

/henri

link publish delete flag offensive edit

answered 2006-04-21 03:22:31 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3696964

By: henrichen

Is that effects.js from script.aculo.us? If so, can I ask which version you are using?

/henri

link publish delete flag offensive edit

answered 2006-04-21 18:50:28 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3697968

By: nobody

yes it is from script.aculo.us. the thing is, it worked for me when I used it in my JSP page. now, i wanted to use the same in the zul file and running into this problem. i am using the same js file that i used with my jsp page.
i dont see any version info in the js page. here is what i am calling.

Effect.Combo = function(element) {
element = $(element);
if(element.style.display == 'none') {
new Effect.OpenUp(element, arguments[1] || {});
}else {
new Effect.CloseDown(element, arguments[1] || {});
}
}

Effect.OpenUp and new Effect.CloseDown are from script.aculo.us js. i am also
including the prototype.js.

As said, it is working for me in JSP but not in zul file. That's troubling me.



link publish delete flag offensive edit

answered 2006-04-22 14:11:19 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3698604

By: henrichen

I don't know if you have noticed. ZK uses the effects.js and prototype.js, too.
I am not sure whether there will be any conflict if you include again the two javascript lib.

I need your help to get things done. Can you provide a reduced but complete zuml page that would replicate the issue so I can trace the problem here.

/henri

link publish delete flag offensive edit

answered 2006-04-23 10:19:40 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3699253

By: nobody

Thats what i had guessed. I did not see that explicitly in the page source on the browser. But here is the zul file.
<?xml version="1.0" encoding="UTF-8"?>
<window title="ACM 2.0" border="normal" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:zk="http://www.potix.com/2005/zk">
<vbox>
<h:script src="javascripts/prototype.js"
type="text/javascript"/>
<h:script src="javascripts/effects.js" type="text/javascript"/>
<h:script src="javascripts/combo.js" type="text/javascript"/>

<h:div id="content"
style="display: none; width: 600px; padding: 2px;">
ACMNG is the next generation product for account management
console.
</h:div>

<separator bar="true" />
<h:div id="footerdiv" align="center">
<h:a

href="javascript:Effect.Combo('content', {duration: 1, scaleX: true, scaleContent:
true});">
About
</h:a>
</h:div>
</vbox>
</window>

The combo js you have it above in the thread which in turn calling scriptaculo effects. i have downloaded this a month back. so i am not using the latest version. secondly, i am not yet using the latest version from zk, still using zk-1.2.0-RC. thanks for helping to find the issue!

link publish delete flag offensive edit

answered 2006-04-23 15:33:22 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3699429

By: henrichen

I will try it.

/henri

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: 2006-04-19 11:57:49 +0800

Seen: 924 times

Last updated: Apr 24 '06

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