reloadOptions

reloads options of the item (combo, select, multiselect only)

void reloadOptions(string name,string|array data);

Parameters

namestringthe name of an item
datastring|arrayan array of options or the URL of the script retrieving the options

Example

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

Details

XML format

<!-- 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>
Back to top