All blog posts, code samples and downloads licensed under Apache License 2.0.

dijit.Dialog - little son of a b****

Today I faced a big problem with the dijit.Dialog from the Dojo toolkit in Domino. What I wanted to do:

  • let the user create a new document from an Xpage
  • the new document (the form) should be shown as a dialog to prevent leaving the current page
  • the dialog was created from a DIV element on my page
  • the DIV contained an IFRAME pointing to the Xpage form for the new document
  • before the dialog was shown the IFRAME was reloaded to prevent conflicts

The result was pretty nice but the form within the IFRAME wasn't editable, the datepickers flickered. The user wasn't able to place data in the form. No way!

After trying alternatives I ended up with that crappy "" stuff to open the form in another window - ugly as hell!

Some hours later I found a solution: the cause for that is the property of the Dojo dialog called "autofocus" that is set to "true" by default. So the solution simply was to call the dialog with the property set to "false" - baaaaam!

Here is an example of what I mean:

var dialog = dijit.byId("dlg");
dialog.set("autofocus", false);;

Or if you want to create a new object from the scratch:

var dialog = new dijit.Dialog({
    content: '<some html>'

Here is an example of a working form dialog:

Tagged with dojo xpage dijit dialog 

Latest comments on this page