Hi! I have a repeat where I'd like to have the user be able to use the "delete" key to remove the current item.
I looked at this: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-Creating-keyboard-shortcuts and this: http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/keyset.html which specifies :"U+007F" The Delete (Del) Key. ...but I'm not sure from this what the final action should look like. Any help with this is appreciated!
-- Francis
|
anyone?
-- Francis
|
Administrator
|
In reply to this post by FParsons
Francis,
You would put an event handler that reacts to users pressing that key, and run the <xforms:delete> pointing to the current item, using the index() function. I have never tried catching the delete key, so keep in mind that the browser might "eat" that key and not make it available to your form. I would first try with ctrl-y (as in the example on the wiki), just to make sure that your action runs and does what you want. Then you can try changing the key code. Alex On Sun, Jun 6, 2010 at 5:40 PM, FParsons <[hidden email]> wrote: > > Hi! I have a repeat where I'd like to have the user be able to use the > "delete" key to remove the current item. > > I looked at this: > http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-Creating-keyboard-shortcuts > and this: > http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/keyset.html > which specifies :"U+007F" The Delete (Del) Key. > > ...but I'm not sure from this what the final action should look like. > > Any help with this is appreciated! > > ----- > -- Francis > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/keyboard-shortcut-for-delete-key-tp2245374p2245374.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > 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 |
Alex - thanks for the reply.
It does work with ev:event="keypress" ev:observer="#document" xxforms:modifiers="Control" xxforms:text="x". But what I want to do is to have a keypress combination be able to remove a repeat item only when that repeat has the focus. Is this possible? If it is possible, would I still be able to use it with a repeat that has a nested repeat, as long as the nested repeat has a different keypress combination? BTW, I did try using the keypress "CTL + D" in IE 7, and IE responded with it's mapping ("save bookmark dialog"), and then the form with it's mapping. So I guess you just have to steer clear of any shortcuts already taken by the browser. I found that the keypress code for the delete key is U+007F. Although this probably wouldn't work anyway (in IE), is it possible to use the keypress codes (maybe for something like "CTL + Delete" or "CTRL + up-arrow") so we can use special keys?
-- Francis
|
Administrator
|
Francis,
You're bringing up some good points: * You have to make sure you're using a key combination that browsers don't intercept. So you might want to test it on a few browser / OS combinations, to check that the combination you picked. * You can have the listener work on items in a repeat. But it will only work when one of the controls in the repeat has the focus. To do this just put the event handler inside an <xforms:group> which is around the <xforms:repeat>. * At this point you can only have plain characters in xxforms:text="...". If we continue borrowing from XBL, we could support the key attribute (http://www.w3.org/TR/xbl/#the-handler), which would allow you listen on specific keys. Then any value defined in http://www.w3.org/TR/DOM-Level-3-Events/#keyset-keyidentifiers could be used there. This isn't supported at this point, so you are constraint to using just "regular" alphanumeric characters. Alex On Fri, Jun 25, 2010 at 9:16 AM, FParsons <[hidden email]> wrote: > > Alex - thanks for the reply. > > It does work with ev:event="keypress" ev:observer="#document" > xxforms:modifiers="Control" xxforms:text="x". > > But what I want to do is to have a keypress combination be able to remove a > repeat item only when that repeat has the focus. Is this possible? If it is > possible, would I still be able to use it with a repeat that has a nested > repeat, as long as the nested repeat has a different keypress combination? > > BTW, I did try using the keypress "CTL + D" in IE 7, and IE responded with > it's mapping ("save bookmark dialog"), and then the form with it's mapping. > So I guess you just have to steer clear of any shortcuts already taken by > the browser. > > I found that the keypress code for the delete key is U+007F. Although this > probably wouldn't work anyway (in IE), is it possible to use the keypress > codes (maybe for something like "CTL + Delete" or "CTRL + up-arrow") so we > can use special keys? > > > > ----- > -- Francis > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/keyboard-shortcut-for-delete-key-tp2245374p2268640.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > 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 |
Alex - I tried this in IE 7 (XP x32):
<xforms:group ref="$current-question-item/RESPONSE_MULTICHOICE" id="multichoice-group"> <xforms:action ev:event="keypress" xxforms:modifiers="control" xxforms:text="y"> <xforms:message level="modal">keypress</xforms:message> </xforms:action> <xforms:repeat nodeset="MULTICHOICE_ITEM" id="multichoice-item-repeat"> ..... but this doesn't seem to work. This repeat, however, is in a repeat, I'm not sure if that matters. Any ideas on what could be going on?
-- Francis
|
Free forum by Nabble | Edit this page |