I now have a different problem, using the Form object .Load() method I get a Javascript error:
Uncaught TypeError: Cannot read property ‘tagName’ of undefined
at Line 1164 of dhtmlxform.js.
Line 1164 reads:
switch(elem[‘object’].tagName){
I am using the dhtmlxform.js version dated 15/03/2010, and the dhtmlxcommon.js file has the same date;
My HTML calls the Form object like this:
myForm = new dhtmlXForm(“data_form”,“mysql_form_connector.php”);
and I am using a function to load the form like this:
function displayForm(id) {
//Uses DHTMLX Form Object to display editable form for specified row of table
//Database Name, Table/SQL, ID and Field List have been identified using SetSessionVariable
myForm.load(id);
}
My PHP file (ysql_form_connector.php) uses this code to fetch the data:
[b]<?php
//
require_once(’…/php/form_connector.php’);
require(’…/php/misc.php’);
//
session_start();
$db_name = getSessionVariable(‘db_name’);
$user_object = getSessionVariable(‘user_object’);
$user_object_id_name = getSessionVariable(‘user_object_id_name’);
$user_object_type = getSessionVariable(‘user_object_type’);
$user_object_sql = getSessionVariable(‘user_object_sql’);
$user_object_field_list = getSessionVariable(‘user_object_field_list’);
//
$dbuser = get_config(‘dbuser’,’’);
$dbpwd = get_config(‘dbpwd’,’’);
$res = mysql_connect(‘localhost’,$dbuser,$dbpwd);
mysql_select_db($db_name,$res);
//
$form = new FormConnector($res);
$form->enable_log(“log.txt”);
//
if($user_object_type == ‘table’) {
$form->render_table($user_object,$user_object_id_name,$user_object_field_list);
} else {
$form->render_sql($user_object_sql,$user_object_id_name,$user_object_field_list);
}
?>[/b]
The meta-data is stored as Session variables, and the Db config are retrieved using the get_config() function.
When I call mysql_form_connector.php in the browser, it generates well-formed XML, and writes to the log:
====================================
Log started, 20/07/2010 11:07:26
SELECT * FROM _menuitem WHERE fk_menu_id=1 AND fk_lang_id=1 AND id
= ‘5’ ORDER BY sequence
ASC
Done in 0.0086870193481445s
I must be doing something wrong somewhere, but I cannot see it!
Thanks for helping,
Richard