I created a Form and attached it to a Layout.
I connected it with a mysql database and the data is loaded. When I change the the content of a field and click on the save button no changes are saved. In fact I have the impression that notting happens beacuse also the validation rules are not working which should be performed before the save(). What am I doing wrong?
Thx for your support!
userForm.php
userForm = [
{type: "settings", position: "label-left", labelWidth: 700, inputWidth: 200},
{type: "fieldset", label: "Create User", inputWidth: 240, list:[
{type: "combo", label: "Login", name: "username", connector: "connector/itDept/userNameCombo.php", filtering: true},
{type: "password", label: "Password", name: "password"},
{type: "password", label: "Confirm Password", name: "comfirmPassword"},
{type: "input", label: "Position", name: "position"},
{type: "input", label: "E-mail Address", name: "email"},
{ type: "combo", label: "1. Department type", name: "dept1", connector: "connector/itDept/deptCombo.php" },
{type: "checkbox", name: "type", label: "Select More Department", labelWidth: "auto", position: "label-right", list:[
{ type: "combo", label: "2. Department type", name: "dept2", connector: "connector/itDept/deptCombo.php", filtering: true },
{ type: "combo", label: "3. Department type", name: "dept3", connector: "connector/itDept/deptCombo.php", filtering: true },
{ type: "combo", label: "4. Department type", name: "dept4", connector: "connector/itDept/deptCombo.php", filtering: true },
]},
{ type: "combo", label: "Access Right", name: "accessRight", connector: "connector/itDept/accessRightCombo.php", filtering: true },
{type: "checkbox", label: "Activate", checked: false, name: "active", value :"1",list:[
{type: "button", value: "Edit User Detail", name: "edit"},
]},
]}
];
myForm = myLayout.cells("c").attachForm(userForm);
myForm.attachEvent("onChange", function (name, value){
if(name == "username"){
myForm.load("connector/itDept/userConnector.php?id="+value);
}
});
myForm.attachEvent("onButtonClick", function(id){
if (id == "edit"){
dhtmlx.alert("Edit Successful !!");
myForm.save();
}
});
dp = new dataProcessor("connector/itDept/userConnector.php");
dp.init(myForm);
userConnector.php
<?php
require_once("../config/config.php");
$res=mysql_connect($mysql_server,$mysql_user,$mysql_pass);
mysql_select_db($mysql_db);
require_once('../../dht/dhtmlxConnector/codebase/form_connector.php');
// sleep(1);
$form = new FormConnector($res);
//$form->enable_log("log.txt");
$form->render_table("office_user","user_id","username,password,email,dept1,dept2,dept3,dept4,position,active,accessRight");
?>