|
From: Ghislain F. <ghi...@28...> - 2012-04-12 08:56:03
|
Hi Kunal,
Thanks for your interest in XQIB!
In the code below, you are using a string. You can provide a QName like so, using a constructor:
b:addEventListener(b:dom()//input[@id="myButton"], "onclick", xs:QName("local:listener"))
In more recent XQIB versions (in the repository trunk), a function item is used instead, so you need to pass local:listener with arity 2, like so:
b:addEventListener(b:dom()//input[@id="myButton"], "onclick", local:listener#2)
The following works on the latest XQIB build (I added a concat to print the content of the text box):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<script type="text/javascript" src="mxqueryjs.nocache.js"></script>
<script type="application/xquery">
declare sequential function local:listener($loc, $evtObj) {
b:alert(concat("Name inserted is ", b:dom()//input[@id="mytxt"]/@value))
};
b:addEventListener(b:dom()//input[@id="myButton"], "onclick", local:listener#2)
</script>
</head>
<body>
XQuery TRY !!!!!
<input id="mytxt" type="text"/>
<input id="myButton" type="button" value="Print Name" />
</body>
</html>
The latest version can be downloaded from there:
http://sgv-jenkins-01.ethz.ch/job/MXQuery-XQIB/ws/MXQuery/build/gwt_war/mxqueryjs/
Does this make sense?
Kind regards,
Ghislain
On Apr 12, 2012, at 6:57 AM, Kunal Chauhan wrote:
> Hi All
>
> I am new with XQIB.
>
> I tried to do some primary excercise. but I am getting error
> Kindly correct me.
> Below is my code.
>
> <!DOCTYPE html>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta charset="UTF-8"/>
> <script type="text/javascript" src="mxqueryjs.nocache.js"></script>
> <script type="application/xquery">
>
> declare sequential function local:listener($loc, $evtObj) {
> b:alert("Name inserted is ")
> };
> b:addEventListener(b:dom()//input[@id="myButton"], "onclick", "local:listener")
> </script>
> </head>
> <body>
> XQuery TRY !!!!!
> <input id="mytxt" type="text"/>
> <input id="myButton" type="button" value="Print Name" />
> </body>
> </html>
>
> Error
>
> some error occurred in the library
> Error : The third argument for b:addEventListener has to be a QName
>
> Thanks,
>
> --
> Kunal Chauhan
> ma...@gm...
> [+918655517141]
> [+919904983614]
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
--
Dr. Ghislain Fourny
Software Architect
28msec Inc.
http://www.28msec.com
http://twitter.com/28msec
|