diff --git a/src/core/js/caosdb.js b/src/core/js/caosdb.js index efc79764dbe9e7ea4760120598b892bb22eeb662..c6b3ce81c432c987c49a62e1fea8484b85d6bf2b 100644 --- a/src/core/js/caosdb.js +++ b/src/core/js/caosdb.js @@ -135,18 +135,19 @@ function getEntityRole(element) { } /** - * Return the unit of element. - * If the corresponding data-attribute can not be found undefined is returned. - * @return A string containing the datatype of the element. + * Return the unit of entity or undefined. + * + * @param {HTMLElement} entity + * @return {String} */ -function getEntityUnit(element) { - var res = $(element).find("input.caosdb-f-entity-unit"); +function getEntityUnit(entity) { + var res = $(entity).find("input.caosdb-f-entity-unit"); if (res.length == 1) { var x = res.val(); return (x == '' ? undefined : x); } - return getEntityHeadingAttribute(element, "unit"); + return getEntityHeadingAttribute(entity, "unit"); } /** diff --git a/src/core/js/form_elements.js b/src/core/js/form_elements.js index d005dd8b494a96bcdefc7c7fde35190c0203f47e..0a492637bf2d9acb96917b17ef3eed8bf2f097e6 100644 --- a/src/core/js/form_elements.js +++ b/src/core/js/form_elements.js @@ -199,13 +199,19 @@ var form_elements = new function () { /** * Return SELECT form element with entity references. * - * 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. + * 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. * * @param {HTMLElement[]} entities - an array with entity elements. * @param {function} [make_desc] - a call-back function with one - * parameter. + * parameter which is an entity in HTML representation. + * @param {function} [make_value] - a call-back function with one + * parameter which is an entity in HTML representation. + * @param {boolean} [multiple] - whether the select allows multiple + * options to be selected. * @returns {HTMLElement} SELECT element with entity options. */ this.make_reference_select = async function (entities, make_desc,