sclass HInputField { S id = aGlobalID(), name, text; bool useWebSocket = true; new MapSO params; // for tag !include #1028121 // setField + change() bool requiresWebSocket() { ret useWebSocket; } bool requiresJQuery() { true; } S html() { new LS out; out.add(tag input("", paramsPlus(params, type := "text", +name, value := text, +id))); if (useWebSocket) out.add(hjs_escapedDollarVars([[ $("#" + $id).on('change keydown paste input', function() { if (typeof wsSend !== 'undefined') wsSend(JSON.stringify({inputFieldText: {id: $id, text: $(this).val()}})); }); ]], +id)); ret lines(out); } void onWebSocketJSON(Map map) { Map map2 = optCast Map(map.get("inputFieldText")), ret if null; S id = cast map2.get("id"); if (!eq(id, this.id)) ret; S text = cast map2.get("text"); setField(+text); } }