Skip to content
Snippets Groups Projects
Verified Commit b08544a5 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

EHN: allow min and max for double fields in form_elements

parent c0616635
No related branches found
No related tags found
1 merge request!37prepare release v0.3.1
......@@ -1328,10 +1328,16 @@ var form_elements = new function () {
* @returns {HTMLElement} a double form field.
*/
this.make_double_input = function (config) {
var clone = $.extend({}, config, {
const _config = $.extend({}, config, {
type: "number"
});
var ret = $(this._make_input(clone))
const ret = $(this._make_input(_config))
if (config.min) {
ret.find("input").attr("min", config.min);
}
if (config.max) {
ret.find("input").attr("max", config.max);
}
ret.find("input").attr("step", "any");
return ret[0];
}
......@@ -1348,12 +1354,6 @@ var form_elements = new function () {
this.make_integer_input = function (config) {
var ret = $(this.make_double_input(config));
ret.find("input").attr("step", "1");
if (config.min) {
ret.find("input").attr("min", config.min);
}
if (config.max) {
ret.find("input").attr("max", config.max);
}
return ret[0];
}
......@@ -1596,4 +1596,4 @@ var form_elements = new function () {
$(document).ready(function () {
caosdb_modules.register(form_elements);
});
\ No newline at end of file
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment