We are still evaluating the CRUD features of dataProcessor. We have a form that includes a combo that consists of customer names. We want the form to populate with customer detail when we select the customer name in the combo. We have been able to select an individual record to populate the form by hard coding (?id=1") the record id. But we have not been able to read the value of the combo selection and pass it to a variable that is called through the php code (?id="+recid). We have tried to follow all examples in the docs, but have not been able to get it to work. See code below:
formData = [
{type:"newcolumn"},
{type:"select",name:"custID",className:"formstyle",label:"ID",
connector:"customerIdCombo.php",inputWidth:100,position:"absolute",
labelLeft:2,labelTop:10,inputLeft:65,inputTop:10},
{type:"input", name:"custName",className:"formstyle",labelWidth:70,
label:"Customer",inputWidth:200,position:"absolute",labelLeft:2,
labelTop:32,inputLeft:65,inputTop:32},
{type:"input", name:"custAddr1",className:"formstyle",labelWidth:70, label:"Address1",inputWidth:200,position:"absolute",labelLeft:2,
labelTop:54,inputLeft:65,inputTop:54},
{type:"input", name:"custAddr2",className:"formstyle",labelWidth:70, label:"Address2",inputWidth:200,position:"absolute",labelLeft:2,
labelTop:76,inputLeft:65,inputTop:76},
{type:"input", name:"custCity",className:"formstyle",labelWidth:70, label:"City",inputWidth:200,position:"absolute",labelLeft:2,
labelTop:98,inputLeft:65,inputTop:98},
{type:"input", name:"custState",className:"formstyle",labelWidth:70, label:"State",inputWidth:200,position:"absolute",labelLeft:2,
labelTop:120,inputLeft:65,inputTop:120},
{type:"input", name:"custZip",className:"formstyle",labelWidth:70, label:"Zip",inputWidth:200,position:"absolute",labelLeft:2,
labelTop:142,inputLeft:65,inputTop:142},
{type:"input", name:"custCountry",className:"formstyle",labelWidth:70, label:"Country",inputWidth:200,position:"absolute",labelLeft:2,
labelTop:164,inputLeft:65,inputTop:164},
{type:"newcolumn"},
{type:"select", name:"custType",className:"formstyle",label:"Type",inputWidth:100,
position:"absolute",labelLeft:300,labelTop:10,inputLeft:370,inputTop:10,
options:[
{value:"1",text:"Manufacturer"},
{value:"2",text:"Distributor"},
{value:"3",text:"Both"},
]},
{type:"input", name:"custPhone1",className:"formstyle",labelWidth:70, label:"Phone",inputWidth:175,position:"absolute",labelLeft:300,
labelTop:32,inputLeft:370,inputTop:32},
{type:"input", name:"custPhone2",className:"formstyle",labelWidth:70,
label:"Alt Phone",inputWidth:175,position:"absolute",labelLeft:300,
labelTop:54,inputLeft:370,inputTop:54},
{type:"input", name:"custFax",className:"formstyle",labelWidth:70, label:"Fax",inputWidth:175,position:"absolute",labelLeft:300,labelTop:76,
inputLeft:370,inputTop:76},
{type:"input", name:"custEmergency",className:"emergstyle",labelWidth:70,
label:"Emergency",inputWidth:155,position:"absolute",labelLeft:300,
labelTop:164,inputLeft:390,inputTop:164},
{type:"newcolumn"},
{type:"calendar", name:"custAcctOpen",className:"formstyle",
dateFormat:"%m/%d/%Y",weekStart:"7", label:"AccountOpened",labelWidth:100,inputWidth:100,position:"absolute",
labelLeft:580,labelTop:32,inputLeft:685,inputTop:32},
{type:"newcolumn"},
{type:"select",name:"custLogoFile",className:"formstyle",
labelWidth:100,label:"Logo File",inputWidth:100,
position:"absolute",labelLeft:810,labelTop:32,inputLeft:870,inputTop:32,
options:[
{text: "cust.png", value: "cust"},
{text: "cust1.png", value: "cust1"},
]},
{type:"container", name:"custLogo", position:"absolute", inputTop:100,
inputLeft:780,inputWidth:175,inputHeight:175},
];
var custForm = new dhtmlXForm("custHeader",formData);
custForm.getContainer("custLogo").innerHTML = "
";
var dp = new dataProcessor('customer_detail.php');
dp.init(custForm);
custID.attachEvent("onChange",function(){
var recid= custID.getSelectedValue();
custForm.load ('customer_detail.php?id='+recid);
});
[u]file – customer_detail.php[/u]
<?php
require_once("../../dhtmlxSuite/dhtmlxConnector/php/codebase/form_connector.php");
$conn = mysql_connect("localhost","root","");
mysql_select_db("customer");
$data = new FormConnector($conn,"MySQL");
$data->render_table("customerDetail","id","id,custID,custName,custAddr1,custAddr2,custCity,custState,custZip,custCountry,custType,custPhone1,custPhone2,custFax,custEmergency,custAcctOpen,custLogoFile");
?>
Thank you for your help.