Good afternoon,
I have problems to send form data to a php file.
Please help me, my code does NOT work.
<!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" xml:lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Welcome to FlOps</title>
<style>
* { margin: 0; padding: 0; }
html {
background: url(images/FlopsVer04.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
<style type="text/css">
#myLabel{
color: red;
font-weight:100;
}
</style>
<link rel="stylesheet" type="text/css" href="codebase/dhtmlx.css">
<script src="codebase/dhtmlx.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.css">
<link rel="stylesheet" type="text/css" href="../dhtmlx/dhtmlxWindows/codebase/skins/dhtmlxwindows_dhx_skyblue.css">
<script src="../dhtmlx/dhtmlxWindows/codebase/dhtmlxcommon.js"></script>
<script src="../dhtmlx/dhtmlxWindows/codebase/dhtmlxcontainer.js"></script>
<script src="../dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.js"></script>
<link rel="stylesheet" type="text/css" href="../dhtmlx/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css">
<script src="../dhtmlx/dhtmlxForm/codebase/dhtmlxcommon.js"></script>
<script src="../dhtmlx/dhtmlxForm/codebase/dhtmlxform.js"></script>
<script src="../dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js" type="text/javascript"></script>
<script src="../dhtmlx/dhtmlxConnector/codebase/connector/connector.js" type="text/javascript"></script>
<script>
var dhxWins;
var dhxForm;
var formData;
var chkValidLogin = 0 //false (true = 1)
var chkValidPassword = 0 //false (true = 1)
var UserName
var Password
function doOnLoad() {
dhxWins = new dhtmlXWindows();
dhxWins.setImagePath("../dhtmlx/dhtmlxWindows/codebase/imgs/");
dhxWins.createWindow("LoginWin", 100, 100, 400, 400);
dhxWins.window("LoginWin").setText("Login");
dhxWins.window("LoginWin").setIcon("Key01.png", "Key01x.png");
dhxWins.window("LoginWin").allowMove();
dhxWins.window("LoginWin").denyResize();
dhxWins.window("LoginWin").button("park").disable();
formData = [
{
type: "fieldset",
label: "Welcome, please enter your",
labelAlign: "left",
width:"auto",
list: [
{
type: "settings",
position: "label-left",
labelAlign: "right",
labelWidth: 80,
inputWidth: 120
},
{
type: "input",
name: "Username",
label: "Username",
value: "login",
validate: "NotEmpty"
},
{
type: "password",
name: "Password",
label: "Password",
value: "123",
validate: "NotEmpty"
},
{
type: "button",
name: "cmdLogin",
offsetLeft: 87,
width: 82,
value: "login",
command: "doFormValidate"
},
],},
{
type: "label",
label:"Input field must NOT be empty!",
labelAlign: "left",
labelWidth: 200,
className: "myLabel",
},
{
type: "button",
name: "cmdSend",
offsetLeft: 87,
width: 82,
value: "send",
command: "doFormSend"
},
];
dhxForm = dhxWins.window("LoginWin").attachForm(formData);
dhxForm.attachEvent("onButtonClick", function(name, command) {
alert("retval ="+name+" "+command);
window[command]();
});
dhxForm.attachEvent("onValidateSuccess", function (input, value, result){
switch(true){
case (input == "Username"):
chkValidLogin = 1;
break;
case (input == "Password"):
chkValidPassword = 1;
break;
};
if (chkValidLogin == 1 && chkValidPassword == 1){
alert("unloading ...")
dhxForm.unload();
}
});
} //end of function doOnLoad
function doFormValidate() {
dhxForm.validate();
}
function doFormSend() {
dhxForm.send("php/mirror.php","post",function(xml){
alert("saved ...");
});
}
</script>
</head>
<body onload="doOnLoad()">
</body>
</html>
Thank you very much in advance.
Best regards
Juergen Heyn, Wilhelmshaven, Germany