Hi Folks,
I’m just getting my feet wet with dhtmlx, and I’m having some trouble populating a form’s select box options from my database via the form connector. This seems very basic, and I think perhaps I’ve missed something.
Upon page load, in one of the cells, a blank form is loaded, which contains only a single select box.
ksForm = eveLayout.cells(“b”).attachForm();
ksForm.loadStruct(“include/xml/selectedks.xml”);
The form looks like this:
<?xml version="1.0" encoding="UTF-8"?>I have an event in the grid on this page that’s supposed to populate the options of the select box from the database:
hostGrid.attachEvent(“onRowSelect”, function(rID){
ksForm.load(“include/php/ksoptions.php?id=”+rID);
})
Here’s the guts of that …
require("…/connector/form_connector.php");
$dbh = mysql_connect(“localhost”,“root”,“xxxxxx”);
mysql_select_db(“xxx”);
$hostid = $_REQUEST[‘id’];
$formConn = new FormConnector($dbh,“MySQL”);
$optsConn = new OptionsConnector($dbh);
$optsSQL = "select kickstarts.id as value, kickstarts.name as label from kickstarts ".
"inner join distro_kickstarts on distro_kickstarts.kickstartid = kickstarts.id ".
"inner join distros on distros.id = distro_kickstarts.distroid ".
“inner join hosts on hosts.distroid = distros.id where hosts.id = $hostid”;
$optsConn->render_sql($optsSQL, “”, “value,label”);
$formConn->set_options(“id”, $optsConn);
$formConn->render_table(“kickstarts”,“id”,“id”);
… now, thanks to the firebug plugin in Chrome, I can see what data is being returned:
<?xml version='1.0' encoding='utf-8' ?>These are the options that I expect… but… these options don’t get populated in the select box in the form.
What might I be missing with how this works?
Thanks!