From 039fe41ef4bb44ece0fa58608f002e4d4fd4fed9 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Mon, 20 Nov 2023 18:58:54 +0000 Subject: [PATCH] fhemweb.js: optional size argument for the textField family (Forum #135850) git-svn-id: https://svn.fhem.de/fhem/trunk@28190 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/www/pgm2/fhemweb.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js index 475bd86f0..b5768ac45 100644 --- a/fhem/www/pgm2/fhemweb.js +++ b/fhem/www/pgm2/fhemweb.js @@ -1643,7 +1643,7 @@ FW_queryValue(cmd, el) function FW_createTextField(elName, devName, vArr, currVal, set, params, cmd) { - if(vArr.length > 2 || + if(vArr.length > 3 || (vArr[0] != "textField" && vArr[0] != "textFieldNL" && vArr[0] != "textField-long" && @@ -1656,13 +1656,14 @@ FW_createTextField(elName, devName, vArr, currVal, set, params, cmd) var newEl = $("
").get(0); if(set && set != "state" && vArr[0].indexOf("NL") < 0) $(newEl).append(set+":"); - $(newEl).append(''); + var iSize = (vArr.length >= 3 ? vArr[2]: 30); + $(newEl).append(''); var inp = $(newEl).find("input").get(0); if(elName) $(inp).attr('name', elName); if(currVal != undefined) $(inp).val(currVal); - if(vArr.length == 2 && !is_long) + if(vArr.length >= 2 && !is_long) $(inp).attr("placeholder", vArr[1]); function addBlur() { if(cmd) $(inp).blur(function() { cmd($(inp).val()) }); }; @@ -2417,14 +2418,16 @@ FW_rescueClient(pid, key)
  • noArg - show no input field.
  • time - show a JavaScript driven timepicker.
    Example: attr FS20dev widgetOverride on-till:time
  • -
  • textField[,placeholder] - show an input field.
    +
  • textField[,placeholder,tfsize] - show an input field. tfsize is the size + attribute for the input field, defaults to 30.
    Example: attr WEB widgetOverride room:textField
  • -
  • textFieldNL[,placeholder] - show the input field and hide the label.
  • -
  • textField-long[,sizePct] - show an input-field, but upon +
  • textFieldNL[,placeholder,tfsize] - show the input field and hide the + label.
  • +
  • textField-long[,sizePct,tfsize] - show an input-field, but upon clicking on the input field open a textArea. sizePct specifies the size of the dialog relative to the screen, in percent. Default is 75
  • -
  • textFieldNL-long[,sizePct] - the behaviour is the same +
  • textFieldNL-long[,sizePct,tfsize] - the behaviour is the same as :textField-long, but no label is displayed.
  • slider,<min>,<step>,<max>[,1] - show a JavaScript driven slider. The optional ,1 at the end