i attached an example… dont know what im doing wrong? used the work without the loadstruct, but want to load the using xml.
example.rar (2.58 KB)
please attach your version of dhtmlxform.js that throws an error “xml not defined”.
its the latest one downloaded from this website… (dhtmlxForm.zip)
I have made a few changes
inloggen2.php
header("Content-Type: text/plain");
echo("good");
die;
example2.php
- Instead of including all separate css & js files I included dhtmlx.css & dhtmlx.js
- Removed the body.onload and used dhtmlxevent instead – dhtmlxEvent(window,“load”,doOnLoad);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
<meta http-equiv="Content-Language" content="Dutch" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="Shortcut Icon" href="images/favicon/favicon.ico">
<link rel="icon" href="images/favicon/favicon.ico" type="image/x-icon">
<style>
html, body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow: hidden;
}
.grid_hover {
background-color:#ffe2a5;
font-size:20px;
}
.dhxlist_obj_dhx_skyblue label{
color:#000000;
font-family:Tahoma;
font-size:11px;
}
.dhxlist_obj_dhx_skyblue .dhxlist_txt_textarea, input.dhtmlx_validation_error{
border: 1px solid #A4BED4;
padding: 1px 0;
}
.dhx_header_cmenu{
background-color:#ffffff;
border:2px outset silver;
z-index:2;
}
.dhx_header_cmenu_item{
white-space:nowrap;
}
</style>
<link rel="stylesheet" type="text/css" href="codebase/dhtmlx.css">
<script>
window.dhx_globalImgPath="codebase/imgs/";
</script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="codebase/dhtmlx.js"></script>
</head>
<body>
<div id="winVP" style="position: relative; height: 100%; width: 100%; border: 0px;"></div>
<script>
var dhxLayout,dhxWins,dhxTreeM,dhxGrid,dhxMenu,statusBar,dhxLogin,GMaps;
var prev = null;
var curr = null;
var next = null;
function doOnLoad()
{
dhxLayout = new dhtmlXLayoutObject(document.body, "2U");
dhxWins = new dhtmlXWindows();
dhxWins.enableAutoViewport(false);
dhxWins.attachViewportTo("winVP");
dhxWins.setImagePath("codebase/imgs/csh_dhx_skyblue/");
createWindow('inloggen');
} // einde body load
// begin venster
var idPrefix = 1;
function createWindow(WindowID) {
var p = 0;
dhxWins.forEachWindow(function() {
p++;
});
if (p > 7) {
alert("Er staan teveel vensters open");
return;
}
var id = "userWin" + (idPrefix++);
var w = 450;
var h = 450;
var x = Number(document.getElementById("win_x").value);
var y = Number(document.getElementById("win_y").value);
dhxWins.createWindow(id, x, y, w, h);
document.getElementById("win_x").value = x + 18;
document.getElementById("win_y").value = y + 16;
dhxWins.window(id).keepInViewport(true);
if (WindowID == "inloggen")
{ // begin inlog venster
dhxWins.window(id).centerOnScreen();
dhxWins.window(id).setModal(true);
dhxWins.window(id).setText("Inloggen");
dhxWins.window(id).denyResize();
dhxWins.window(id).denyPark();
dhxWins.window(id).button("close").disable();
dhxWins.window(id).button("park").hide();
dhxWins.window(id).button("minmax1").hide();
dhxWins.window(id).setIcon("lock.png");
dhxWins.window(id).setDimension(280, 200);
var dhxLogin = dhxWins.window(id).attachForm();
dhxLogin.loadStruct("inloggen.php");
dhxLogin.attachEvent("onButtonClick", function (name, cmd)
{ // begin attachevent
if (cmd == "doLogin")
{ // begin cmd
dhxLogin.send("inloggen2.php?etc="+new Date().getTime(), "get", function(response)
{ // begin send
var checkok = response.xmlDoc.responseText;
if (checkok == "good")
{ // begin goed inloggen
dhxWins.window(id).close();
statusBar.setText("Ingelogd.");
} // einde goed inloggen
else
{ // begin fout inloggen
alert("Onjuiste inlog gegevens.");
} // einde fout inloggen
}); // einde send
} // einde cmd
}); // einde attachevent
} // einde inlog venster
}
dhtmlxEvent(window,"load",doOnLoad);
</script>
<input id="win_x" type="hidden" value="10"> <input id="win_y" type="hidden" value="20">
</body>
</html>
And here is the form:
If I enter anything as username/password the login form closes and shows me the layout.
Seems to be working.
if i just include the dhtmlx.js , can i still use grid and other components then?
Yes
dhtmlx.js is a “compiled” version of all modules you need included.
This is a quote from the readme.txt in libCompiler folder of your dhtmlx distribution
im still getting the same error…
I don’t know, maybe it’s something with your webserver then.
Try to load form as a string directly and then with XML file and not PHP.
Maybe you will manage to identify when the error happens.
I’m having the same problem.
so if I use the dhtmlx.js instead of the dhtmlxform.js, the demo 33.zip in andrei post wont work
im changing:
[code]
[/code]to:
<script src="codebase/dhtmlx.js"></script>
i’m using the newest dhtmlx.js:
dhtmlx.com/x/download/regula … xSuite.zip
im using the coldfusion server script instead php.
the error in firebug:
[code]xml is not defined
send:function(url, mode, callback){if…htmlxAjax.post(url,query,cback);else
dhtmlx.js (line 2716)[/code]
Probably the demo 33 contained the fixed dhtmlxform.js. You may generate the new dhtmlx.js using libCompiler from the Suite package (it requires PHP). You neen to replace the dhtmlxform.js in the codebase and sources folders with the new one and then use libCompiler.
ok thx for your reply, I will try it
My form look s like this:
echo ‘<items>’; echo ‘<item type=“label” label=“Vul uw gebruikersnaam en wachtwoord in.”/>’; echo ‘<item type=“input” name=“login” label=“Gebruikersnaam” validate=“NotEmpty”/>’; echo ‘<item type=“password” name=“pwd” label=“Wachtwoord” validate=“NotEmpty”/>’; echo ‘<item type=“checkbox” label=“Onthoud mijn gegevens” checked=“false”/>’; echo ‘<item type=“button” command=“doLogin” value=“Inloggen”/>’; echo ‘</items>’;