3 Replies Latest reply on Mar 30, 2009 10:37 AM by Lars-Remi Pettersen

    Focus after reRender

    Lars-Remi Pettersen Newbie

      Hey there,

      I have an HtmlSimpleTogglePanel with different fields, among them an HtmlInputText. On this field I have ajax support set to call an action that updates the toggle panel's label with the value of the text field. This works great, but whenever I type in the text field and the page rerenders the toggle panel the text field loses focus (I suspect this is because it is located inside another component that is being rerendered). I tried using the setFocus() method on the ajax support with the id of the text field. This works too, but the entire contents of the text field is marked whenever it gets focus set, meaning that continuous writing is impossible (seeing as how writing while text is marked means the marked text disappears).

      Is there any way to make sure the HtmlInputText does not lose focus after its parent component is rerendered, or alternately some way to regain focus to it without marking all the text?