Hello the Orbeon's users,
This my first problem: I try to capture a keyDown event (arrow key: down, up ...) with javascript and to dispatch to a input but I don't sucess. It's Ok with a <xf:action ev:event="keypress" xxforms:text="b"> but not with my personal javascript event... My try is in the attach file... Where is the problem, please? And this is my second problem: with these new events, I want to navigate with the arrow keys in a datatable but I don't know how to have an acces to the good id for the focusIn event. All the help is welcome :-) Fabien PS: my try: <?xml version="1.0" encoding="ISO-8859-1"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xf="http://www.w3.org/2002/xforms"> <head> <title>XForms, Javascript and key</title> <script type="text/javascript"> function myKeydown(event) { var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0; switch(key) { case 37: ORBEON.xforms.Document.dispatchEvent("menuModel", "toucheGauchePress"); break; case 38: ORBEON.xforms.Document.dispatchEvent("menuModel", "toucheHautPress"); break; case 39: ORBEON.xforms.Document.dispatchEvent("menuModel", "toucheDroitePress"); break; case 40: ORBEON.xforms.Document.dispatchEvent("menuModel", "toucheBasPress"); break; } YAHOO.util.Event.addListener(document, "keyDown", myKeydown); </script> <xf:model id="menuModel" xxforms:external-events="toucheBasPress toucheHautPress"> <xf:instance id="tableInstance" xmlns=""> <table> <line> <rep>bien</rep> <rep>insuffisant</rep> <rep>excellent</rep> </line> <line> <rep>danger</rep> <rep>excuse</rep> <rep>retenue</rep> </line> <line> <rep>vide</rep> <rep>moyen</rep> <rep>moyen</rep> </line> </table> </xf:instance> <xf:action ev:event="toucheBasPress"> <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> </xf:action> </xf:model> </head> <body> <fr:alert-dialog id="overwrite-file-dialog"> <fr:label>Test</fr:label> <fr:message>Hello World</fr:message> <fr:negative-choice /> <fr:positive-choice /> </fr:alert-dialog> <xf:group id="datatableGroup"> <xf:input id="exempleControl" ref="instance('sessionInstance')/etab/nom"> <xf:action ev:event="toucheBasPress"> <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> </xf:action> </xf:input> <br /> <xf:input ref="instance('tableInstance')/line[1]/rep[1]"> <xf:action ev:event="keypress" xxforms:text="b"> <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> </xf:action> </xf:input> <br /> <xf:input ref="instance('tableInstance')/line[1]/rep[1]"> <xf:action ev:event="toucheBasPress"> <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> </xf:action> </xf:input> <div> <fr:datatable scrollable="both"> <thead> <tr> <xf:repeat nodeset="xxforms:instance('tableInstance')/line[1]/rep"> <th> <xf:output href="." /> </th> </xf:repeat> </tr> </thead> <tbody> <xf:repeat nodeset="xxforms:instance('tableInstance')/line"> <tr> <xf:repeat nodeset="rep"> <th> <xf:input ref="." /> </th> </xf:repeat> </tr> </xf:repeat> </tbody> </fr:datatable> </div> </xf:group> <fr:xforms-inspector /> </body> </html> -- 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 |
It's me again. I resolve my first problem and perhaps it's could help other person :-) I can now capture keyDown arrow event in all the document. So I search now how to use this in a part of the form (in the datatable, it will be great :-) ) and I could now search for my second problem: the navigation in the datatable with the arrows... I accept all help :-) Fabien PS: this is ly new file with a try for a event only on the datatable but it's not ok. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xf="http://www.w3.org/2002/xforms"> <head> <title>XForms, Javascript and key</title> <script type="text/javascript"> function myKeydown(event) { var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0; switch(key) { case 37: ORBEON.xforms.Document.dispatchEvent("menuModel", "toucheGauchePress"); break; case 38: ORBEON.xforms.Document.dispatchEvent("menuModel", "toucheHautPress"); break; case 39: ORBEON.xforms.Document.dispatchEvent("menuModel", "toucheDroitePress"); break; case 40: ORBEON.xforms.Document.dispatchEvent("inputId", "toucheBasPress"); break; } }; /* For all the document */ /* YAHOO.util.Event.addListener(document, "keydown", myKeydown); */ </script> <xf:model id="menuModel" xxforms:external-events="toucheBasPress toucheHautPress toucheDroitePress toucheGauchePress"> <xf:instance id="tableInstance" xmlns=""> <table> <line> <rep>bien</rep> <rep>insuffisant</rep> <rep>excellent</rep> </line> <line> <rep>danger</rep> <rep>excuse</rep> <rep>retenue</rep> </line> <line> <rep>vide</rep> <rep>moyen</rep> <rep>moyen</rep> </line> </table> </xf:instance> <xf:action ev:event="toucheBasPress"> <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> </xf:action> </xf:model> </head> <body> <fr:alert-dialog id="overwrite-file-dialog"> <fr:label>Test</fr:label> <fr:message>Hello World</fr:message> <fr:negative-choice /> <fr:positive-choice /> </fr:alert-dialog> <xf:group id="datatableGroup"> <xxforms:script ev:event="xforms-enabled"> /*My bad try... */ var group = ORBEON.util.Dom.getElementByTagName(this, "group"); YAHOO.util.Event.addListener(group, "keydown", myKeydown); </xxforms:script> <br /> <xf:input id="inputId" ref="instance('tableInstance')/line[1]/rep[1]"> <xf:action ev:event="toucheBasPress"> <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> </xf:action> </xf:input> <div> <fr:datatable scrollable="both"> <thead> <tr> <xf:repeat nodeset="xxforms:instance('tableInstance')/line[1]/rep"> <th> <xf:output href="." /> </th> </xf:repeat> </tr> </thead> <tbody> <xf:repeat nodeset="xxforms:instance('tableInstance')/line"> <tr> <xf:repeat nodeset="rep"> <th> <xf:input ref="." /> </th> </xf:repeat> </tr> </xf:repeat> </tbody> </fr:datatable> </div> </xf:group> <fr:xforms-inspector /> </body> </html> Le 12/08/2010 00:09, Fabien GUENEGO a écrit : Hello the Orbeon's users, -- 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 |
Administrator
|
In reply to this post by Fabien GUENEGO
Fabien,
It doesn't work? That's why you want to use the ev:event="keypress" xxforms:text="b" instead ;). Seriously, the YAHOO.util.Event.addListener() was inside myKeydown(), so it wasn't called. And the event name was misspelled (it should be keydown with a lowercase 'd'). With this, your events are dispatched. Most likely you'll also want to prevent the browser default behavior for the cursor keys, which otherwise will scroll the window in addition to calling your listeners. You can do this by adding YAHOO.util.Event.preventDefault(event); at the end of your listener. I attached your code with those updates. Alex On Wed, Aug 11, 2010 at 3:09 PM, Fabien GUENEGO <[hidden email]> wrote: > Hello the Orbeon's users, > > This my first problem: > > I try to capture a keyDown event (arrow key: down, up ...) with javascript > and to dispatch to a input but I don't sucess. It's Ok with a <xf:action > ev:event="keypress" xxforms:text="b"> but not with my personal javascript > event... > My try is in the attach file... Where is the problem, please? > > And this is my second problem: > with these new events, I want to navigate with the arrow keys in a datatable > but I don't know how to have an acces to the good id for the focusIn event. > > All the help is welcome :-) > > Fabien > > PS: my try: > > <?xml version="1.0" encoding="ISO-8859-1"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:fr="http://orbeon.org/oxf/xml/form-runner" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xf="http://www.w3.org/2002/xforms"> > <head> > <title>XForms, Javascript and key</title> > > <script type="text/javascript"> > function myKeydown(event) { > var key = event.charCode ? event.charCode : event.keyCode ? > event.keyCode : 0; > switch(key) { > case 37: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheGauchePress"); > break; > case 38: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheHautPress"); > break; > case 39: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheDroitePress"); > break; > case 40: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheBasPress"); > break; > } > YAHOO.util.Event.addListener(document, "keyDown", myKeydown); > </script> > > <xf:model id="menuModel" xxforms:external-events="toucheBasPress > toucheHautPress"> > > <xf:instance id="tableInstance" xmlns=""> > <table> > <line> > <rep>bien</rep> > <rep>insuffisant</rep> > <rep>excellent</rep> > </line> > <line> > <rep>danger</rep> > <rep>excuse</rep> > <rep>retenue</rep> > </line> > <line> > <rep>vide</rep> > <rep>moyen</rep> > <rep>moyen</rep> > </line> > </table> > </xf:instance> > > <xf:action ev:event="toucheBasPress"> > <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> > </xf:action> > </xf:model> > </head> > <body> > <fr:alert-dialog id="overwrite-file-dialog"> > <fr:label>Test</fr:label> > <fr:message>Hello World</fr:message> > <fr:negative-choice /> > <fr:positive-choice /> > </fr:alert-dialog> > <xf:group id="datatableGroup"> > <xf:input id="exempleControl" ref="instance('sessionInstance')/etab/nom"> > <xf:action ev:event="toucheBasPress"> > <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> > </xf:action> > </xf:input> > <br /> > > <xf:input ref="instance('tableInstance')/line[1]/rep[1]"> > <xf:action ev:event="keypress" xxforms:text="b"> > <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> > </xf:action> > </xf:input> > <br /> > <xf:input ref="instance('tableInstance')/line[1]/rep[1]"> > <xf:action ev:event="toucheBasPress"> > <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> > </xf:action> > </xf:input> > > <div> > <fr:datatable scrollable="both"> > <thead> > <tr> > <xf:repeat nodeset="xxforms:instance('tableInstance')/line[1]/rep"> > <th> > <xf:output href="." /> > </th> > </xf:repeat> > </tr> > </thead> > <tbody> > <xf:repeat nodeset="xxforms:instance('tableInstance')/line"> > <tr> > <xf:repeat nodeset="rep"> > <th> > <xf:input ref="." /> > </th> > </xf:repeat> > </tr> > </xf:repeat> > </tbody> > </fr:datatable> > </div> > </xf:group> > <fr:xforms-inspector /> > > </body> > </html> > > > > > > -- > 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 > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ 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 20100812-keyboard-event.xhtml (6K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Administrator
|
In reply to this post by Fabien GUENEGO
Fabien,
Good; and I should have read all your message before responding! :) Alex On Thu, Aug 12, 2010 at 7:24 AM, Fabien GUENEGO <[hidden email]> wrote: > Hello, > > It's me again. > I resolve my first problem and perhaps it's could help other person :-) > I can now capture keyDown arrow event in all the document. > So I search now how to use this in a part of the form (in the datatable, it > will be great :-) ) > and I could now search for my second problem: the navigation in the > datatable with the arrows... > I accept all help :-) > > Fabien > PS: this is ly new file with a try for a event only on the datatable but > it's not ok. > > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:fr="http://orbeon.org/oxf/xml/form-runner" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xf="http://www.w3.org/2002/xforms"> > <head> > <title>XForms, Javascript and key</title> > > <script type="text/javascript"> > function myKeydown(event) { > var key = event.charCode ? event.charCode : event.keyCode ? > event.keyCode : 0; > switch(key) { > case 37: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheGauchePress"); > break; > case 38: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheHautPress"); > break; > case 39: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheDroitePress"); > break; > case 40: > ORBEON.xforms.Document.dispatchEvent("inputId", > "toucheBasPress"); > break; > } > }; > /* For all the document */ > /* YAHOO.util.Event.addListener(document, "keydown", myKeydown); */ > </script> > > <xf:model id="menuModel" xxforms:external-events="toucheBasPress > toucheHautPress toucheDroitePress toucheGauchePress"> > > <xf:instance id="tableInstance" xmlns=""> > <table> > <line> > <rep>bien</rep> > <rep>insuffisant</rep> > <rep>excellent</rep> > </line> > <line> > <rep>danger</rep> > <rep>excuse</rep> > <rep>retenue</rep> > </line> > <line> > <rep>vide</rep> > <rep>moyen</rep> > <rep>moyen</rep> > </line> > </table> > </xf:instance> > > <xf:action ev:event="toucheBasPress"> > <xf:dispatch target="overwrite-file-dialog" name="fr-show" > /> > </xf:action> > </xf:model> > </head> > <body> > <fr:alert-dialog id="overwrite-file-dialog"> > <fr:label>Test</fr:label> > <fr:message>Hello World</fr:message> > <fr:negative-choice /> > <fr:positive-choice /> > </fr:alert-dialog> > <xf:group id="datatableGroup"> > > <xxforms:script ev:event="xforms-enabled"> > /*My bad try... */ > var group = ORBEON.util.Dom.getElementByTagName(this, "group"); > YAHOO.util.Event.addListener(group, "keydown", myKeydown); > </xxforms:script> > <br /> > <xf:input id="inputId" > ref="instance('tableInstance')/line[1]/rep[1]"> > > <xf:action ev:event="toucheBasPress"> > <xf:dispatch target="overwrite-file-dialog" > name="fr-show" /> > </xf:action> > </xf:input> > > <div> > <fr:datatable scrollable="both"> > > <thead> > <tr> > <xf:repeat > nodeset="xxforms:instance('tableInstance')/line[1]/rep"> > <th> > <xf:output href="." /> > </th> > </xf:repeat> > </tr> > </thead> > <tbody> > <xf:repeat > nodeset="xxforms:instance('tableInstance')/line"> > <tr> > <xf:repeat nodeset="rep"> > <th> > <xf:input ref="." /> > </th> > </xf:repeat> > </tr> > </xf:repeat> > </tbody> > </fr:datatable> > </div> > </xf:group> > <fr:xforms-inspector /> > > </body> > </html> > > > > > Le 12/08/2010 00:09, Fabien GUENEGO a écrit : > > Hello the Orbeon's users, > > This my first problem: > > I try to capture a keyDown event (arrow key: down, up ...) with javascript > and to dispatch to a input but I don't sucess. It's Ok with a <xf:action > ev:event="keypress" xxforms:text="b"> but not with my personal javascript > event... > My try is in the attach file... Where is the problem, please? > > And this is my second problem: > with these new events, I want to navigate with the arrow keys in a datatable > but I don't know how to have an acces to the good id for the focusIn event. > > All the help is welcome :-) > > Fabien > > PS: my try: > > <?xml version="1.0" encoding="ISO-8859-1"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:fr="http://orbeon.org/oxf/xml/form-runner" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xf="http://www.w3.org/2002/xforms"> > <head> > <title>XForms, Javascript and key</title> > > <script type="text/javascript"> > function myKeydown(event) { > var key = event.charCode ? event.charCode : event.keyCode ? > event.keyCode : 0; > switch(key) { > case 37: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheGauchePress"); > break; > case 38: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheHautPress"); > break; > case 39: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheDroitePress"); > break; > case 40: > ORBEON.xforms.Document.dispatchEvent("menuModel", > "toucheBasPress"); > break; > } > YAHOO.util.Event.addListener(document, "keyDown", myKeydown); > </script> > > <xf:model id="menuModel" xxforms:external-events="toucheBasPress > toucheHautPress"> > > <xf:instance id="tableInstance" xmlns=""> > <table> > <line> > <rep>bien</rep> > <rep>insuffisant</rep> > <rep>excellent</rep> > </line> > <line> > <rep>danger</rep> > <rep>excuse</rep> > <rep>retenue</rep> > </line> > <line> > <rep>vide</rep> > <rep>moyen</rep> > <rep>moyen</rep> > </line> > </table> > </xf:instance> > > <xf:action ev:event="toucheBasPress"> > <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> > </xf:action> > </xf:model> > </head> > <body> > <fr:alert-dialog id="overwrite-file-dialog"> > <fr:label>Test</fr:label> > <fr:message>Hello World</fr:message> > <fr:negative-choice /> > <fr:positive-choice /> > </fr:alert-dialog> > <xf:group id="datatableGroup"> > <xf:input id="exempleControl" ref="instance('sessionInstance')/etab/nom"> > <xf:action ev:event="toucheBasPress"> > <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> > </xf:action> > </xf:input> > <br /> > > <xf:input ref="instance('tableInstance')/line[1]/rep[1]"> > <xf:action ev:event="keypress" xxforms:text="b"> > <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> > </xf:action> > </xf:input> > <br /> > <xf:input ref="instance('tableInstance')/line[1]/rep[1]"> > <xf:action ev:event="toucheBasPress"> > <xf:dispatch target="overwrite-file-dialog" name="fr-show" /> > </xf:action> > </xf:input> > > <div> > <fr:datatable scrollable="both"> > <thead> > <tr> > <xf:repeat nodeset="xxforms:instance('tableInstance')/line[1]/rep"> > <th> > <xf:output href="." /> > </th> > </xf:repeat> > </tr> > </thead> > <tbody> > <xf:repeat nodeset="xxforms:instance('tableInstance')/line"> > <tr> > <xf:repeat nodeset="rep"> > <th> > <xf:input ref="." /> > </th> > </xf:repeat> > </tr> > </xf:repeat> > </tbody> > </fr:datatable> > </div> > </xf:group> > <fr:xforms-inspector /> > > </body> > </html> > > > > > > > -- > 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 > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |