[richfaces-issues] [JBoss JIRA] Commented: (RF-3632) Lost input focus after rerendering parent form

Benno Markiewicz (JIRA) jira-events at lists.jboss.org
Wed Jun 4 10:38:20 EDT 2008


    [ http://jira.jboss.com/jira/browse/RF-3632?page=comments#action_12415583 ] 
            
Benno Markiewicz commented on RF-3632:
--------------------------------------

I thought as much.

Thanks for the focus tip, i already tried it before. 

    <h:form id="myform">
        <h:panelGrid columns="2">
            <h:inputText id="myinput" value="#{userBean.name}">
                <a4j:support event="onkeyup" reRender="myform" focus="myinput"/>
            </h:inputText>
            <h:outputText id="outtext" value="#{userBean.name}" />
        </h:panelGrid>
    </h:form>

But when you use it that way the whole text in the inputText will be selected after rerendering. The position cursor has changed.

F.e.
Before: selection start = x, selection end = x
After: selection start = 0, selection end =n-1

(x is the position within the text, n is the length of the text)

> Lost input focus after rerendering parent form
> ----------------------------------------------
>
>                 Key: RF-3632
>                 URL: http://jira.jboss.com/jira/browse/RF-3632
>             Project: RichFaces
>          Issue Type: Bug
>    Affects Versions: 3.2.1
>         Environment: RF 3.2.1.CR3
> IE 6
> Firefox 2.0.0.11
> Java 1.5.0_15
> jetty-6.1.9
> WinXP SP2
>            Reporter: Benno Markiewicz
>
> A control within a parent form looses its focus when the parent form is rerendered. The rerendering was forced by an event fired from the child control. See the source (based on http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf?c=support)
>     <h:form id="myform">
>         <h:panelGrid columns="2">
>             <h:inputText id="myinput" value="#{userBean.name}">
>                 <a4j:support event="onkeyup" reRender="myform" />
>             </h:inputText>
>             <h:outputText id="outtext" value="#{userBean.name}" />
>         </h:panelGrid>
>     </h:form>
> Notice the difference. Instead of  "outtext" "myform" will be rerendered.
> Background: You have a detail form with several components. Every control on the form changes the internal state. The view represents the actual state, so the whole form has to be rerendered. But when you rerender the parent form, the focus/selection state of the actual component is lost.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list