dojo - How to make and display a form in a Dijit Dialog programmatically? -



dojo - How to make and display a form in a Dijit Dialog programmatically? -

i've been trying figure out how create , display form within of dialog using dojo 1.7.

i want dialog this:

all samples have seen using markup, none using amd

when create dialog, can utilize widget (e.g. form) content. so, example, do:

class="lang-javascript prettyprint-override">require([ "dijit/dialog", "dijit/form/form", "dijit/form/textbox", "dijit/form/button", "dojo/domready!" ], function(dialog, form, textbox, button) { var form = new form(); new textbox({ placeholder: "name" }).placeat(form.containernode); new button({ label: "ok" }).placeat(form.containernode); var dia = new dialog({ content: form, title: "dialog form", style: "width: 300px; height: 300px;" }); form.startup(); dia.show(); });//~require

require() provided dojo. loads dependencies (form, dialog etc) , runs given function creates widgets. however, because include domready! among dependencies, dojo makes sure dom loaded , ready first.

because have dia.show() in function too, dialog shown page opened. let's wanted show dialog when button on page clicked instead:

class="lang-javascript prettyprint-override">require([ "dijit/dialog", "dijit/form/form", "dijit/form/textbox", "dijit/form/button", "dojo/on", // added this! "dojo/domready!" ], function(dialog, form, textbox, button, onevent) { // ... above, create dialog , form when page loads // remains hidden until phone call dia.show() ... form.startup(); // dia.show(); commented out this! onevent(document.getelementbyid("somebuttononyourpage"), "click", function() { dia.show(); }); });//~require

forms dojo dialog

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -