diff --git a/src/core/js/form_elements.js b/src/core/js/form_elements.js index 0a492637bf2d9acb96917b17ef3eed8bf2f097e6..003445399498558c86017984b3c0d5da544532bf 100644 --- a/src/core/js/form_elements.js +++ b/src/core/js/form_elements.js @@ -243,15 +243,47 @@ var form_elements = new function () { return ret[0]; } + /** + * @typedef {option} ReferenceDropDownConfig + * + * Configuration object for a drop down menu for selecting references. + * `make_reference_drop_down` generates such a drop down menu using a + * SELECT input with the references as its OPTION elements. + * + * The `query` parameter contains a query which is executed. The + * resulting entities are used to generate the OPTIONs. + * + * The OPTIONs' values are generated by the `make_value` call-back + * function from the entities. If `make_value` is undefined the + * entities' ids are used as values. The description which is generated + * by a `make_desc` call-back function. If `make_desc` is undefined, + * the ids are shown instead. + * + * The generated HTMLElements also contain a LABEL tag showing the text + * defined by `label`. If the `label` property is undefined, the `name` + * is shown instead. + * + * @property {string} name - The name of the select input. + * @property {string} query - Query for entities. + * @property {function} [make_value] - Call-back for the generation of + * the OPTIONs' values from the entities. + * @property {function} [make_desc] - Call-back for the generation of + * the OPTIONs' description from the entities. + * @property {boolean} [multiple] - Whether it is possible to select + * multiple options at once. + * @property {string} [value] - Pre-selected value of the SELECT. + * @property {string} [label] - LABEL text. + * @property {string} [type] - This should be "reference_drop_down" or + * undefined. This property is used by `make_form_field` to decide + * which type of field is to be generated. + * + */ /** * Search and retrieve entities and create a SELECT from element. * - * The OPTIONS have the entities' ids as values and a description which - * is generated by a `make_desc` call-back function. If `make_desc` is - * undefined, the ids are shown instead. - * - * @param {object} config + * @param {ReferenceDropDownConfig} config - all necessary parameters + * for the configuration. * @returns {HTMLElement} SELECT element. */ this.make_reference_drop_down = function (config) {