setItemFocus + position of cursor

Can you help placing the cursor at end of text in text input when using setItemFocus().
Would be a nice feature somehow.

Hi
You can set onFocus form event and use something like this:
davidwalsh.name/caret-end

Just tried to extend your sources.
Can you give me a hint what i’m doing wrong?

[code]dhtmlXForm.prototype.items.select.setFocus = function(item) {

var el = item.childNodes[item._ll?1:0].childNodes[0];
el.focus();

if (typeof el.selectionStart == "number") {
    el.selectionStart = el.selectionEnd = el.value.length;
} else if (typeof el.createTextRange != "undefined") {
    el.focus();
    var range = el.createTextRange();
    range.collapse(false);
    range.select();
}

}[/code]

Hi

you can try something like the following:

myForm.attachEvent("onFocus", function(name){ if ({input:1, password:1}[myForm.getItemType(name)] == 1) { var i = myForm.getInput(name); window.setTimeout(function(){ window.dhx4.selectTextRange(i, i.value.length, i.value.length); i = null; },1); } });