Check documentation for the latest version of dhtmlxSuite SelectOptionsConnector DHTMLX Docs

SelectOptionsConnector

SelectOptionsConnector is used by the dhtmlxForm component to fill a list of options for the 'select' item.

Don't confuse SelectOptionsConnector with OptionsConnector. The second one is an auxiliary connector and used just in the context of dhtmlxGrid and dhtmlxScheduler components. SelectOptionsConnector is an independent connector able to generate output XML data.

So, to define options of the select form's item you should make the following:

1. On the client side you should specify the parameter 'connector':

var formData = [
    {type: "select", label: "Categories", connector:"options.php"},
    {type: "button", value: "Proceed"}
];
myForm = new dhtmlXForm("form_container", formData);

2. On the server side your code will look like this:

<?php 
require_once("../codebase/connector/options_connector.php");
$res=new PDO("mysql:dbname=tasks;host=localhost","root","");
 
$data = new SelectOptionsConnector($res, "MySQL");
$data->render_table("categories","id","value, label");
 
?>

The render_table method takes the following parameters:

  • 'categories' - the name of table.
  • 'id' - the id column
  • 'value' - the column that will be used as values of options.
  • 'label' - the column that will be used as labels of options.
Back to top