2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-25 09:55:38 +00:00

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
This commit is contained in:
rudolfkoenig 2023-11-20 18:58:54 +00:00
parent 7d01c2908e
commit 039fe41ef4

View File

@ -1643,7 +1643,7 @@ FW_queryValue(cmd, el)
function function
FW_createTextField(elName, devName, vArr, currVal, set, params, cmd) FW_createTextField(elName, devName, vArr, currVal, set, params, cmd)
{ {
if(vArr.length > 2 || if(vArr.length > 3 ||
(vArr[0] != "textField" && (vArr[0] != "textField" &&
vArr[0] != "textFieldNL" && vArr[0] != "textFieldNL" &&
vArr[0] != "textField-long" && vArr[0] != "textField-long" &&
@ -1656,13 +1656,14 @@ FW_createTextField(elName, devName, vArr, currVal, set, params, cmd)
var newEl = $("<div style='display:inline-block'>").get(0); var newEl = $("<div style='display:inline-block'>").get(0);
if(set && set != "state" && vArr[0].indexOf("NL") < 0) if(set && set != "state" && vArr[0].indexOf("NL") < 0)
$(newEl).append(set+":"); $(newEl).append(set+":");
$(newEl).append('<input type="text" size="30">'); var iSize = (vArr.length >= 3 ? vArr[2]: 30);
$(newEl).append('<input type="text" size="'+iSize+'">');
var inp = $(newEl).find("input").get(0); var inp = $(newEl).find("input").get(0);
if(elName) if(elName)
$(inp).attr('name', elName); $(inp).attr('name', elName);
if(currVal != undefined) if(currVal != undefined)
$(inp).val(currVal); $(inp).val(currVal);
if(vArr.length == 2 && !is_long) if(vArr.length >= 2 && !is_long)
$(inp).attr("placeholder", vArr[1]); $(inp).attr("placeholder", vArr[1]);
function addBlur() { if(cmd) $(inp).blur(function() { cmd($(inp).val()) }); }; function addBlur() { if(cmd) $(inp).blur(function() { cmd($(inp).val()) }); };
@ -2417,14 +2418,16 @@ FW_rescueClient(pid, key)
<li>noArg - show no input field.</li> <li>noArg - show no input field.</li>
<li>time - show a JavaScript driven timepicker.<br> <li>time - show a JavaScript driven timepicker.<br>
Example: attr FS20dev widgetOverride on-till:time</li> Example: attr FS20dev widgetOverride on-till:time</li>
<li>textField[,placeholder] - show an input field.<br> <li>textField[,placeholder,tfsize] - show an input field. tfsize is the size
attribute for the input field, defaults to 30. <br>
Example: attr WEB widgetOverride room:textField</li> Example: attr WEB widgetOverride room:textField</li>
<li>textFieldNL[,placeholder] - show the input field and hide the label.</li> <li>textFieldNL[,placeholder,tfsize] - show the input field and hide the
<li>textField-long[,sizePct] - show an input-field, but upon label.</li>
<li>textField-long[,sizePct,tfsize] - show an input-field, but upon
clicking on the input field open a textArea. clicking on the input field open a textArea.
sizePct specifies the size of the dialog relative to the screen, in sizePct specifies the size of the dialog relative to the screen, in
percent. Default is 75</li> percent. Default is 75</li>
<li>textFieldNL-long[,sizePct] - the behaviour is the same <li>textFieldNL-long[,sizePct,tfsize] - the behaviour is the same
as :textField-long, but no label is displayed.</li> as :textField-long, but no label is displayed.</li>
<li>slider,&lt;min&gt;,&lt;step&gt;,&lt;max&gt;[,1] - show <li>slider,&lt;min&gt;,&lt;step&gt;,&lt;max&gt;[,1] - show
a JavaScript driven slider. The optional ,1 at the end a JavaScript driven slider. The optional ,1 at the end