This content has been marked as final.
Show 2 replies
-
1. Re: focus (highlight problem) after ajax request
andrei_exadel Sep 8, 2008 7:12 AM (in response to c_ljungblad)Hi,
This is a known issue. It will be fixed in future version.
Now please use the following workaround:
1. Add JS function to the page:<script type="text/javascript"> function setCaretToEnd (e) { var control = $((e.target ? e.target : e.srcElement).id); if (control.createTextRange) { var range = control.createTextRange(); range.collapse(false); range.select(); } else if (control.setSelectionRange) { control.focus(); var length = control.value.length; control.setSelectionRange(length, length); } control.selectionStart = control.selectionEnd = control.value.length; } </script>
2. Remove focus attribute. Assign the function on 'oncomplete' event:<a4j:support event="onkeyup" ... oncomplete="setCaretToEnd(event);"/>
-
2. Re: focus (highlight problem) after ajax request
c_ljungblad Sep 8, 2008 9:01 AM (in response to c_ljungblad)Terrific, thanks!! Now it "works" in IE and partly in FF.
In FF, the cursor is set to the correct position. But if the inputTextArea has some text in it and have become "scrollable" I have to scroll down to the end of the textArea.
In IE focus will stay put at the end of the inputTextArea after reRender.
Tried this in: IE7.0.5730.13 and FF 2.0.0.16
/Chris