diff --git a/FHEM/01_FHEMWEB.pm b/FHEM/01_FHEMWEB.pm index 9f640479f..75ff07c35 100755 --- a/FHEM/01_FHEMWEB.pm +++ b/FHEM/01_FHEMWEB.pm @@ -3064,7 +3064,12 @@ FW_widgetOverride($$) ":slider,<min>,<step>,<max>", then a javascript driven slider is displayed
  • if the modifier is of the form ":multiple,val1,val2,...", then - multiple values can be selected, the result is comma separated.
  • + multiple values can be selected and own values can be written, the + result is comma separated. +
  • if the modifier is of the form ":multiple-strict,val1,val2,...", then + multiple values can be selected and no new values can be added, the + result is comma separated.
  • +
  • else a dropdown with all the modifier values is displayed
  • If this attribute is specified for a FHEMWEB instance, then it is @@ -3607,9 +3612,13 @@ FW_widgetOverride($$) ":slider,<min>,<step>,<max>", so wird ein in JavaScript programmierter Slider angezeigt -
  • Ist der Modifier ":multiple,val1,val2,...", dann ein - Mehrfachauswahl ist möglich, das Ergebnis ist - Komma-separiert.
  • +
  • Ist der Modifier ":multiple,val1,val2,...", dann ist eine + Mehrfachauswahl möglich und es können neue Werte gesetzt + werden. Das Ergebnis ist Komma-separiert.
  • + +
  • Ist der Modifier ":multiple-strict,val1,val2,...", dann ist eine + Mehrfachauswahl möglich, es können jedoch keine neuen + Werte definiert werden. Das Ergebnis ist Komma-separiert.
  • In allen anderen Fällen erscheint ein Dropdown mit allen Modifier Werten.
  • diff --git a/www/pgm2/fhemweb_multiple.js b/www/pgm2/fhemweb_multiple.js index 7c22bc119..f6797f46f 100644 --- a/www/pgm2/fhemweb_multiple.js +++ b/www/pgm2/fhemweb_multiple.js @@ -1,7 +1,7 @@ function FW_multipleSelChange(name, devName, vArr) { - if(vArr.length < 2 || vArr[0] != "multiple") + if(vArr.length < 2 || (vArr[0] != "multiple" && vArr[0] != "multiple-strict")) return undefined; var o = new Object(); @@ -10,14 +10,17 @@ FW_multipleSelChange(name, devName, vArr) o.newEl.size=30; o.qFn = 'FW_multipleSetSelected(qArg, "%")'; o.qArg = o.newEl; - o.newEl.setAttribute('onFocus', 'FW_multipleSelect(this)'); + + o.newEl.setAttribute('onFocus', vArr[0] == "multiple-strict" ? + 'FW_multipleSelect(this, true)' : 'FW_multipleSelect(this, false)'); + o.newEl.setAttribute('allVals', vArr); o.newEl.setAttribute('readonly', 'readonly'); return o; } function -FW_multipleSelect(el) +FW_multipleSelect(el, strict) { loadLink("pgm2/jquery-ui.min.css"); loadScript("pgm2/jquery.min.js", function(){ @@ -42,10 +45,11 @@ FW_multipleSelect(el) var selArr=[]; for(var i1 in selObj) selArr.push(i1); + $('body').append( ''); $('#multidlg').dialog( @@ -80,3 +84,7 @@ FW_multipleSetSelected(el, val) FW_widgets['multiple'] = { selChange:FW_multipleSelChange }; + +FW_widgets['multiple-strict'] = { + selChange:FW_multipleSelChange +};