Login  Register

Re: Problem with ORBEON.xforms.Document.dispatchEvent

Posted by Alessandro Vernet on Oct 31, 2009; 4:39am
URL: https://discuss.orbeon.com/Including-conditional-comments-in-your-XForm-tp41984p329078.html

Gopi,

On Wed, Oct 28, 2009 at 8:26 AM, Reddy, Gopikrishna
<[hidden email]> wrote:
> I Have requirement of Setting some values if we Press hot Keys.
>
> For this I have written the code attached .
>
> Problem:Event is not firing when we call the event in java script

The problem seems to be just with the JavaScript code intercepting the
key. Since we already using YUI for the Orbeon Forms, you can use the
YUI library instead of registering your key handler "by hand". This
does the trick for the key ctrl-y:

function doSomething() {
    console.log("Do something");
    ORBEON.xforms.Document.dispatchEvent("main-model","do-something");
}

YAHOO.util.Event.onDOMReady(function() {
    new YAHOO.util.KeyListener(document, { ctrl:true, keys:89 }, { fn:
doSomething } ).enable();
});

You will also find attached your example updated with the above JavaScript code.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

key.xhtml (2K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet