2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00
fhem-mirror/fhem/www/pgm2/fhemweb_textField.js
rudolfkoenig dd4da9d6ea FHEMWEB: csrfToken added
git-svn-id: https://svn.fhem.de/fhem/trunk@6388 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2014-08-10 13:52:25 +00:00

47 lines
879 B
JavaScript

function
FW_textFieldUpdateLine(d)
{
var name = "textField."+d[0];
el = document.getElementById(name);
if(el)
el.value = d[1];
}
function
FW_textFieldSelChange(name, devName, vArr)
{
if(vArr.length != 1 || vArr[0] != "textField")
return undefined;
var o = new Object();
o.newEl = document.createElement('input');
o.newEl.type='text';
o.newEl.size=30;
o.qFn = 'FW_textFieldSetSelected(qArg, "%")';
o.qArg = o.newEl;
return o;
}
function
FW_textFieldSetSelected(el, val)
{
if(typeof el == 'string')
el = document.getElementById(el);
el.value=val;
}
function
textField_setText(el,cmd)
{
var v = el.value;
var req = new XMLHttpRequest();
var qcmd = addcsrf(cmd.replace('%',v));
req.open("GET", qcmd, true);
req.send(null);
}
FW_widgets['textField'] = {
updateLine:FW_textFieldUpdateLine,
selChange:FW_textFieldSelChange
};