Dhtmlx Connector / Data Processor not working with forms

Hi,
I have applied to the core the correct instructions in building a form and also the connector file and processor files in PHP. My codes are as below:
///////////////////////////////////////////////////
Table Creation Script
///////////////////////////////////////////////////
CREATE TABLE transp_type (
transp_id int(11) NOT NULL AUTO_INCREMENT,
transp_desc varchar(10) NOT NULL,
comment varchar(32) DEFAULT NULL,
PRIMARY KEY (transp_id)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COMMENT=‘Transportation Types’;
///////////////////////////////////////////////////
My HTML File: transp_type.html
///////////////////////////////////////////////////

var myForm; function doOnLoad() { //Form Initialization myForm = new dhtmlXForm("myForm"); myForm.loadStruct("trans_type.xml");
  //Loading data from the database
  myForm.load('transp_type.php?id=1');
  
  //Data Processor Initialization
  var mydp=new dataProcessor("transp_type.php?id=1");
  mydp.init(myForm);
  
  //Event Handlers in case of Button Clicks
  myForm.attachEvent("onButtonClick", function(id)
  {if(id=="save"){
    myForm.save();}
    else if(id=="fetch"){
    myForm.load("transp_type.php?id=1");
    }
  }       
  )
}
</script>
/////////////////////////////////////////////////// My Form Definition XML File. trans_type.xml /////////////////////////////////////////////////// <?xml version="1.0"?> This is auto generated field
<item type="input" required="true" name="transp_desc" label="Description">
  <note>Description of Transport Type</note>
</item>

<item type="input" name="comment" label="Comments, if any" rows="3">
  <note>Additional information, if any</note>
</item>
<item type="block">
  <item type="button" name="save" value="Save"/>
  <item type="newcolumn"/>
  <item type="button" name="fetch" value="Fetch" position="absolute"/>
</item>
/////////////////////////////////////////////////////// My PHP connector and data processor file. transp_type.php /////////////////////////////////////////////////////// <?php require_once("../codebase/dhtmlxconnector/codebase/form_connector.php"); $res=mysql_connect("localhost","root",""); mysql_select_db("sampleapp");

$conn = new FormConnector($res,“MySQL”);// connector initialization

$conn->set_encoding(“iso-88591-1”); //I added this seeing a forum solution for spl characters
$conn->render_table(“transp_type”,“transp_id”,“transp_id,transp_desc,comment”);
?>
////////////////////////////////////////////////////////////

The issue is that despite form getting rendered properly the data pulling and update are not working. Help me please. Matter Urgent. The errors displayed in the browser are in the attached PDF files for your reference.

Thanks in advance
Regards
Manish






There are two errors in the js console.

First one is related to the order of js files - dhtmlxcommon.js must be included on the page before other js files.

Also, you have on the page
var mydp=new dataProcessor(“transp_type.php?id=1”);
but dhtmlxdataprocessor.js was never included.

Hi Stanislav,
I have made the suggested changes in the code and they are reproduced below. The errors in the JS Console disappeared but the rendering/display of the data and the insert operation and the query operations are still not working. Kindly help.

Thanks in advance.
Manish.
/////////////////////////////////
transp_type.html
////////////////////////////////

/////////////////////////

Hi Stanislav,
In order enable you to get the idea properly, I’m attaching my code for your inspection.
Is it that am missing something? Kindly advise.

Regards
Manish.
code.zip (1.48 KB)

a) change in js code the order or data loading like next, to ensure that data will load only after configuration

myForm.loadStruct(“trans_type.xml”, function(){
myForm.load(‘data.xml?id=1’);
});

b) in form config xml, change id attribute to the name attribute

    <item type="input" name="transp_id" label="ID" bind="Id" readonly="true">

Cool!!! Thanks a lot it worked.

Regards
Manish