DHTMLX Docs & Samples Explorer

reloadOptions (name, data)

Reloads options of the item (combo, select, multiselect only).

Required file: ext/dhtmlxform_dyn.js

Parameters:

  • name - the id of item (the item's parameter 'name')
  • data - an array with options or the url of the script retrieving the options
var formData = [
    {type: "multiselect", name: "crud_right", label: "Can create/edit/delete users:", options:[
        {text: "Administrators", value: "Option 1", selected: true},
        {text: "Power users", value: "Option 2", selected: true},
        {text: "All users", value: "Option 5"}
    ]}
];
 
myForm.reloadOptions("crud_right", [
    {text: "Registered users", value: "Option 1", selected: true},
    {text: "Guests", value: "Option 2", selected: true}
]);
 
// or with connector
var formData = [
    {type: "combo", name: "colors", label: "Select color:", connector: "php/colors.php?id=1"}
];
myForm.reloadOptions("colors", "php/colors.php?id=2"); // see xml formats below

XML format for “combo”

<complete>
    <option value="value_a">text</option>
    <option value="value_b" selected="true">new text</option>
    ...
</complete>

XML format for “select”

<data>
    <item value="value_a" label="text"/>
    <item value="value_b" label="new text" selected="true"/>
    ...
</data>