I have an SQL table with 2 columns:
Now in the combo i want to list First and Last Name, how can I make this?
I hive tried whit the following line:
$combo->render_sql(“SELECT * FROM table1”,“LastName”,“LastName, FirstName”);
but only the LastName appear.
(a)
$combo->render_sql("SELECT *, CONCAT(FirstName, LastName) as label FROM table1","id","id,label");
(b)
You can use beforeRender server side event, to update data in any necessary way.
OK, i have tried.
a) The output result in Xml seems to be correct:
<?xml version="1.0" encoding="iso-8859-1" ?>
- <complete>
- <option value="1">
- <![CDATA[ Smith Paul ]]>
</option>
</complete>
But when I try to load the data in combobox an error message appears:
Error Type: Load XML
Description: Incorrect XML
And I can not find the error. Any good idea?
b) i have tried to play with the code for before render, but nothing to do…the XML files didn’t appear.
The above xml snippet is correct, problem may be caused by some extra output from custom code | includes.
or
combo can request url, which is different from the one which you are using for testing. And for that url, output is different.
The load of XML code works fine.
If I selct * from the table, the combo works correct, if I insert the “concatenate” part, the XML file is correct but the combo didn’t work 
Are you using combo in load-once or in suggest mode?
Here is the code for the combo:
<script>
var z=new dhtmlXCombo("combo_zone1","",230);
z.enableFilteringMode(true,"system/Cliente_Search.php",true);
</script>
You are using combo in filtering mode, which mean - it will try to filter data by “label” field, which is in your case a “virtual field” and can’t be used by filtering.
Try to use
combo->render_sql("SELECT *, CONCAT(FirstName, LastName) as label FROM table1","id","id,FirstName(label)");
with such config, it will load data in combo as you wish, and filter by using FirstName
More stable solution can be in creating of view in the DB, which will combine two fields in a single one. Such view can be used as parameter in the render table ( and will work as normal table )