1 Reply Latest reply on Jan 25, 2011 9:55 AM by Ilya Sorokoumov

    Field focus jumps unpredictably upon rerender

    Steven De Groote Newbie



      I'm having a quite annoying problem with a4j:support in the following structure:



                              <rich:panel id="ps">


                              <mw:panel id="ps">

                                  <ui:repeat var="setting" value="#{quoteInput.service.pSettings}">

                                      <t:panelGrid columns="3">

                                          <h:outputLabel for="pcs" value="#{setting.labelText}:" />

                                          <h:selectOneListbox id="pcs" size="1" value="#{setting.value}">

                                              <f:selectItems value="#{setting.choiceItems}"/>

                                              <a4j:support event="onchange" reRender="ps" ajaxSingle="true" />


                                          <h:message styleClass="error" for="pcs" />


                                      <ui:repeat var="qsetting" value="#{setting.qSettings}">

                                          <t:panelGrid columns="3">

                                              <h:outputLabel value="#{qsetting.labelText}:"/>


                                                  <h:inputText id="qinputn" value="#{qsetting.value}"/>










      Within this, when I switch the value of one of the generated pcs dropdowns, I perform a rerender of all code posted here ("ps"). It is possible that due to this switch, more or less qsetting elements will appear. All this works fine.


      The problem is that when doing so, after everything is done (oncomplete), for some reason the focus of my field is lost, and moved to an apparently random "pcs" dropdown. So, is there a possiblity to prevent this focus switching, or at least some explanation as to why this is happening?