Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ludo on Dec 08, 2009 04:57
open dhtmlx forum
Getting started with dhtmlxcombo from data source

Hello,

I am just getting started with your software and finding it difficult to get the answers I require from your documentation.

Here is what I require initially (sounds easy!):

A dhtmlcombo form component with data from a mysql database that I can use on my site.

So far I have created a test.php file so:

<?php
require_once("connector/config.php");
$res=mysql_connect($mysql_server,$mysql_user,$mysql_pass);
mysql_select_db($mysql_db);

require("connector/combo_connector.php");
$combo = new ComboConnector($res);
$combo->enable_log("connector/temp.log");

$combo->render_table("content_type_search_city","field_post_code_value","field_destination_value");

?>
This generates an xml file on screen, I have tried to make a test2.php file to display the test.php results in a combo form following your website documentation, without success. I have been programming for many years and would not be asking for support uneccesarily. I just can't get my head round how this works. Even though test.php generates an xml file, where is it? It has no name or path to reference. I have read through the documentation numerous times, and still cant work out how to display the combo (with the data) in a form, that I can use on my site. As a potential customer, please point me in the right direction.

Regards,

Ludo...

Answer posted by Alex (support) on Dec 08, 2009 05:54

Hello,

test.php generates the xml stream. You can set the path to this script as the parameter of the loadXML method:

combo.loadXML("test.php");

Answer posted on Dec 08, 2009 06:12
Hi, Thanks again.

Following http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxcombo:adding_options

and your reply the contents of test2.php are:

<?php combo.loadXML("test.php"); ?>

Results in:


Fatal error: Call to undefined function loadXML() in /var/www/test2.php on line 3

I must be missing something fundemental!

Answer posted by Alex (support) on Dec 08, 2009 06:18
Answer posted by Ludo on Dec 08, 2009 06:39
In test3.php I now have:

<link rel="STYLESHEET" type="text/css" href="connector/dhtmlxcombo.css">
<script  src="connector/dhtmlxcommon.js"></script>
<script  src="connector/dhtmlxcombo.js"></script>

<script>
var z = dhtmlXComboFromSelect("combo_zone1");
var z = new dhtmlXCombo("combo_zone2", "alfa2", 200);
z.readonly(1);
z.loadXML("test.php");
</script>

Result: Blank page...

Answer posted by Alex (support) on Dec 08, 2009 06:48

The example of the html page:
<html>
<head>
 <script>
  window.dhx_globalImgPath="connector/ømgs/";
 </script>
 <link rel="STYLESHEET" type="text/css" href="connector/dhtmlxcombo.css">
 <script src="connector/dhtmlxcommon.js"></script>
 <script src="connector/dhtmlxcombo.js"></script>
</head>
<body>
 <div id="combo_zone2" style="width:200px; height:30px;"></div>
 <script> 
  var z=new dhtmlXCombo("combo_zone2","alfa2",200);
  z.loadXML("test.php");
 </script>
</body>
</html>

Answer posted by Ludo on Dec 08, 2009 06:57
I now have a page!!!!

Nostrovia!!   (what do you think of my russian spelling?)
Answer posted by Alex (support) on Dec 08, 2009 07:23

>> what do you think of my russian spelling?

Not bad :)