Form with select item with info from DB

Hello,

I’ve been trying for a few days to do the following. I’m using your Contact Manager tutorial as a base and I’ve been reading your documentation.

I want to add a combobox or select item to the form in the layout.

Client side:

var formPersonsData = [
				{type: "select", name: "ingress", label: "Ingreso", bind: "ingressData", connector: "ingress.php"},
				{type: "button", name: "btn", value: "Submit"}
			];
			formPersons = layout.cells("a").attachForm(formPersonsData);
			
			//formPersons.loadStruct("xml/form.xml");

Server side:

<?php
	require("../../codebase/form_connector.php");
	// db connect info
	mysql_select_db("inpa");
	
	$list = new OptionsConnector($res,"MySQL");
	$list->render_sql("SELECT idingress as value, ingressDate as label FROM ingress","","idingress(value),ingressDate(label)");
?>

All I get is a blank alert.

I also tried the following server side code:

<?php
	require_once('../../codebase/form_connector.php');
	$res=mysql_connect("localhost","root","inpa2010");
	$options = new SelectOptionsConnector($res);
	$options->render_sql("SELECT idingress as value, ingressDate as label FROM ingress","","idingress(value),ingressDate(label)");
?>

And I get “Fatal error: Class ‘SelectOptionsConnector’ not found in ingress.php on line 4”.

Any help on this would be greatly appreciated.

change
require_once(’…/…/codebase/form_connector.php’);

as
require_once(’…/…/codebase/connector/options_connector.php’);

You can check the dhtmlxForm\samples\05_data\php\options.php in the form’s package.

awesome! let me give it a go. I didn’t check the samples!