function EditText (id) { var id = id; this.setValue = function (value) { new Form ().set ("value["+id+"]", value); } this.getValue = function () { return new Form ().get ("value["+id+"]"); } this.getUpdateValue = function (value) { return value; } this.insertText = function (text) { // new Form ().set ("value["+id+"]", new Form ().get ("value["+id+"]") + text) var input = document.getElementById ("value["+id+"]"); var start = input.selectionStart; var end = input.selectionEnd; input.value = input.value.substr (0, start) + text + input.value.substr (end); input.selectionStart = input.selectionEnd = start + text.length; } this.focus = function () { new Form ().focus ("value["+id+"]"); } }