Loading ...
Sorry, an error occurred while loading the content.

RE: [ydn-javascript] Submit Dialog on Enter Key Press

Expand Messages
  • Satyen Desai
    Hi, Not through configuration, but you can use the KeyListener infrastructure, to bind a listener to the Enter key, and invoke the same function which you use
    Message 1 of 4 , Jul 1, 2008
    View Source
    • 0 Attachment
      Hi,
      Not through configuration, but you can use the KeyListener infrastructure, to bind a listener to the Enter key, and invoke the same function which you use for your handler (setting a scope if required).

      See:
      http://developer.yahoo.com/yui/examples/container/keylistener.html
      http://developer.yahoo.com/yui/docs/YAHOO.util.KeyListener.html

      A couple of notes:

      a). The element you're listening on does not necessarily need to be the document as in the above example. It could be the container's bounding box also, but in order for the key listener to be invoked in that case, something within the bounding box will need to have focus.

      b). I assume you're not talking about hitting Enter when the button has focus, which you'll get for free - viz. The button's 'click' listeners will get invoked if you hit Enter when the button has focus.

      Hope that helps,
      Satyen

      ________________________________________
      From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of Frank
      Sent: Thursday, June 26, 2008 9:54 AM
      To: ydn-javascript@yahoogroups.com
      Subject: [ydn-javascript] Submit Dialog on Enter Key Press

      I have two buttons defined on my dialog, is it possible to define that
      one of them will be executed (it's handler) when the Enter key is pressed?

      I did some searching and this issue seems to have come up before but I
      couldn't find a proper solution in the posts.
    Your message has been successfully submitted and would be delivered to recipients shortly.