2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhemweb.js: better select initialization (Forum #124505)

git-svn-id: https://svn.fhem.de/fhem/trunk@25292 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2021-12-04 15:17:48 +00:00
parent 3bd2498957
commit 5301587614

View File

@ -1577,18 +1577,19 @@ FW_createSelect(elName, devName, vArr, currVal, set, params, cmd)
vHash[o.value] = 1;
newEl.options[j-1] = o;
}
if(typeof(currVal) != "undefined")
$(newEl).val(currVal);
if(elName)
$(newEl).attr('name', elName);
if(cmd)
$(newEl).change(function(arg) { cmd($(newEl).val()) });
newEl.setValueFn = function(arg) {
if(!vHash[arg])
if(!vHash[arg] && typeof(arg) != "undefined")
arg = arg.replaceAll(" ","."); // Forum #124505
if(vHash[arg])
$(newEl).val(arg);
};
newEl.setValueFn(currVal);
return newEl;
}