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

21335Focus not set on dialog when shown via script

Expand Messages
  • mhaertl73
    Nov 23, 2007
    • 0 Attachment

      i want to show a dialog on context menu click. Therefore i use a
      function to set some dialog properties and show it. The focus never
      gets set - even if i try to call focus() on the input element manually.

      If i trigger dialog.show() with a button click, everything works.

      Any ideas?

      <script type="text/javascript">
      YAHOO.util.Event.onDOMReady( function() {
      var showDialog=function(o) {
      // focus will not be set:
      contextMenu = new YAHOO.widget.ContextMenu("myContext", { trigger:
      contextMenu.addItem( {text: "Show dialog", onclick: { fn: showDialog
      } });

      var markupDialog=new YAHOO.widget.Dialog("markupDialog", { width :
      "300px", visible : false,
      buttons : [ { text:"OK" } ]

      // focus will be set:
      YAHOO.util.Event.addListener("mybutton", "click", markupDialog.show,
      markupDialog, true);

      <div id="menuTest" style="width:200px; height:100px; border: 2px solid
      #ccc">Right click here</div>

      <div id="markupDialog">
      <div class="hd">Testdialog</div>
      <div class="bd"><form action="#"><input type="text"></form></div>

      <button id="mybutton">Show Dialog</button>
    • Show all 4 messages in this topic