dhtmlxconnector:selectoptionsconnector [DHX documentation]

PHP Connector DHTMLX

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 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 server-side your code will look like:

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

    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.