trouble attaching form to popup window

Hi,

I’m trying to make it so when a user clicks a button of the toolbar, they get a popup window with a form to fill out. The window is working beautifully, but I can’t seem to get the form to attach to it.
Here’s what I’ve got so far:

[code]var popupWindow1a = dhxLayout.dhxWins.createWindow(“addContacts”,50,50, 500, 500);
dhxLayout.dhxWins.window(“addContacts”).centerOnScreen();
dhxLayout.dhxWins.window(“addContacts”).setText(“Add Contact”);
dhxLayout.dhxWins.window(“addContacts”).setImagePath(“codebase/imgs/”);

				 form1a = dhxLayout.dhxWins.window("addContacts").attachForm();
					form1a.loadStruct("addContact.json", "json");[/code]

And then an external json file with:

[code][

	{type: "fieldset",name:"addcontacts", label: "", inputWidth: "auto", list:[
    
	{type: "input", name: 'category', label: 'Category:'},
    {type:"input", name:"lastname", label:"Last Name:"},
    {type:"input", name:"firstname", label:"First Name:"},
	{type:"input", name:"middlename", label:"Middle Name:"},
	{type:"input", name:"suffix", label:"Suffix"},
    
    {type:"button", name:"submit", width:75,offsetTop:5, value:"+ Add"}, 
	]}

][/code]

I expect I’m missing something obvious, but I’m not sure what.

Thanks!

Hi
At start try to comment the nest line:
dhxLayout.dhxWins.window(“addContacts”).setImagePath(“codebase/imgs/”);
It must clear the issue.

Thanks! I never would have guessed that was the problem. :mrgreen:

You are welcome :slight_smile:

Hi there,

i’d like to join this topic, seems to me I got nearly the same issue on attaching a form to a window.

When a button on a toolbar is clicked, a window with a form in it pops up.

This is the IE Debug Error I get:

Object doesn't support this property or method: user, line 80, character 13

And this is the code my index.html

[code]






	<script src="../../../includes/dhtmlsuite/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script>

	<script src="../../../includes/dhtmlsuite/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
	
	<script src="../../../includes/phpconnector/codebase/connector.js"></script>		

	<script src="../../../includes/dhtmlsuite/dhtmlxToolbar/codebase/dhtmlxcommon.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxToolbar/codebase/dhtmlxtoolbar.js"></script>

	<script src="../../../includes/dhtmlsuite/dhtmlxForm/codebase/dhtmlxcommon.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxForm/codebase/dhtmlxform.js"></script>

	<script src="../../../includes/dhtmlsuite/dhtmlxWindows/codebase/dhtmlxcontainer.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxWindows/codebase/dhtmlxcommon.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxWindows/codebase/dhtmlxwindows.js"></script>

</head>

<body>
	<div id="gridbox" style="width:*; height:90%;"></div>
	<div id="toolbar"></div>

	<script>
	
		mygrid = new dhtmlXGridObject("gridbox");
		mygrid.setImagePath("../../../includes/dhtmlsuite/dhtmlxGrid/codebase/imgs/");
		mygrid.setHeader("ID,Benutzer,eMail,Name,Vorname,Passwort,Admin");
		mygrid.setInitWidths("50,200,200,200,200,*,100");
		mygrid.setColTypes("ed,ed,ed,ed,ed,ed,ed");
		mygrid.attachHeader(",#connector_text_filter,#connector_text_filter");
		mygrid.setColSorting("connector,connector,connector,connector,connector,connector,connector");
		mygrid.setSkin("dhx_web");
		mygrid.init();
		mygrid.loadXML("index_table.php");

		var dp = new dataProcessor("index_table.php");
			dp.init(mygrid);

		var toolbar = new dhtmlXToolbarObject("toolbar", "dhx_web");
			toolbar.setIconsPath("../../../includes/dhtmlsuite/dhtmlxToolbar/codebase/imgs/");
		    toolbar.addButton("add", 1, "Add","new.gif", "new_dis.gif");
		    toolbar.addButton("delete", 2, "Delete","cut.gif", "cut_dis.gif");
		    toolbar.addButton("form", 3, "Formular","paste.gif", "paste_dis.gif");


		    toolbar.attachEvent("onClick", 
		    		function(id){
		    			  			    			
		    			switch (id) {
							case "add":
								var newId = (new Date()).valueOf();
    							mygrid.addRow(newId,",Benutzer,eMail,Name,Vorname,Pass,0");
							break;
							case "delete":
							    var selId = mygrid.getSelectedId()
    								mygrid.deleteRow(selId);
							break;
							case "form":
								var dhxWins = new dhtmlXWindows();								
						    	    dhxWins.createWindow(1, 0,0, 300, 500);
					    	        dhxWins.setSkin("dhx_web");
					    	        dhxWins.window(1).setText("Neuen User anlegen");
					    	        dhxWins.window(1).denyResize();
									dhxWins.window(1).button("park").disable();
									dhxWins.window(1).button("park").hide();
									dhxWins.window(1).centerOnScreen();

								var myForm = dhxWins.window(1).attachForm();
									myForm.loadStruct("index_form.xml");
	
							break;
						}
		    		});
	</script>
</body>
[/code]

thanks a lot…

Matt

I forgot:

Line 80, character 13 is this line:

var myForm = dhxWins.window(1).attachForm();

Hi, mb1811
To check your issue we need completed demo to reproduce it.
Please, create it being guided this: docs.dhtmlx.com/doku.php?id=othe … leted_demo and attach.

Here we go:

dl.dropboxusercontent.com/u/214 … x/demo.zip

index.html is in /src/admin/user/

Makes it easier to not change all includes :wink:

Thanks for your support - I appreciate that!

We have an alert, what your archive is broken or have damaged files.
Please, check it and reattach

Hmm, strange…

this should work: dl.dropboxusercontent.com/u/214 … x/demo.zip

Here is you code for index.html page:

[code]






    <script src="../../../includes/dhtmlsuite/dhtmlxWindows/codebase/dhtmlxcommon.js"></script>
    <script src="../../../includes/dhtmlsuite/dhtmlxWindows/codebase/dhtmlxcontainer.js"></script>
    <script src="../../../includes/dhtmlsuite/dhtmlxWindows/codebase/dhtmlxwindows.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script>

	<script src="../../../includes/dhtmlsuite/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
	<script src="../../../includes/phpconnector/codebase/connector.js"></script>
    <script src="../../../includes/dhtmlsuite/dhtmlxToolbar/codebase/dhtmlxtoolbar.js"></script>
	<script src="../../../includes/dhtmlsuite/dhtmlxForm/codebase/dhtmlxform.js"></script>



</head>

<body>
	<div id="gridbox" style="width:*; height:90%;"></div>
	<div id="toolbar"></div>

	<script>
	
		mygrid = new dhtmlXGridObject("gridbox");
		mygrid.setImagePath("../../../includes/dhtmlsuite/dhtmlxGrid/codebase/imgs/");
		mygrid.setHeader("ID,Benutzer,eMail,Name,Vorname,Passwort,Admin");
		mygrid.setInitWidths("50,200,200,200,200,*,100");
		mygrid.setColTypes("ed,ed,ed,ed,ed,ed,ed");
		mygrid.attachHeader(",#connector_text_filter,#connector_text_filter");
		mygrid.setColSorting("connector,connector,connector,connector,connector,connector,connector");
		mygrid.setSkin("dhx_web");
		mygrid.init();
		mygrid.loadXML("index_table.php");

		var dp = new dataProcessor("index_table.php");
			dp.init(mygrid);

		var toolbar = new dhtmlXToolbarObject("toolbar", "dhx_web");
			toolbar.setIconsPath("../../../includes/dhtmlsuite/dhtmlxToolbar/codebase/imgs/");
		    toolbar.addButton("add", 1, "Add","new.gif", "new_dis.gif");
		    toolbar.addButton("delete", 2, "Delete","cut.gif", "cut_dis.gif");
		    toolbar.addButton("form", 3, "Formular","paste.gif", "paste_dis.gif");


		    toolbar.attachEvent("onClick", 
		    		function(id){
		    			  			    			
		    			switch (id) {
							case "add":
								var newId = (new Date()).valueOf();
    							mygrid.addRow(newId,",Benutzer,eMail,Name,Vorname,Pass,0");
							break;
							case "delete":
							    var selId = mygrid.getSelectedId()
    								mygrid.deleteRow(selId);
							break;
							case "form":
								var dhxWins = new dhtmlXWindows();								
						    	    dhxWins.createWindow("addContacts", 0,0, 300, 500);
					    	        dhxWins.setSkin("dhx_web");
					    	        dhxWins.window("addContacts").setText("Neuen User anlegen");
					    	        dhxWins.window("addContacts").denyResize();
									dhxWins.window("addContacts").button("park").disable();
									dhxWins.window("addContacts").button("park").hide();
									dhxWins.window("addContacts").centerOnScreen();

								var myForm = dhxWins.window("addContacts").attachForm();
									myForm.loadStruct("index_form.xml");
	
							break;
						}
		    		});
	</script>
</body>
[/code] Please, replace with yours one.