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

Re: Focus not set on dialog when shown via script

Expand Messages
  • mhaertl73
    Thank you very much for your help. It didn t solve my problem completely but at least it helps me to create a workaround. The real reason for my problem is
    Message 1 of 4 , Dec 3, 2007
      Thank you very much for your help. It didn't solve my problem
      completely but at least it helps me to create a workaround.

      The real reason for my problem is still somewhere in Dialog. I tried
      this (just snippets shown, other code like before):

      scriptDialog=new YAHOO.widget.Dialog("scriptDialog", {
      width : "300px",
      visible : false,
      buttons : [
      { text:"OK", handler: function() { this.submit() },
      isDefault:true },
      { text:"Cancel", handler: function() { this.cancel() } }
      ]
      });

      // Dialog will only be shown when uncommenting this line:
      //scriptDialog.setBody('');
      scriptDialog.form.appendChild(document.createElement("input"));
      scriptDialog.form.elements[0].type="text";
      scriptDialog.form.method="POST";
      scriptDialog.render(document.body);

      Look at the commented line. It only works, if you uncomment this line
      and set Body to empty string. But then again: The focus will not be set.

      If you use

      scriptDialog.setBody('<form action="#"><input type="text"></form>');

      instead of the above, focus will be set again.
    Your message has been successfully submitted and would be delivered to recipients shortly.