Field focus jumps unpredictably upon rerender
tomba Jan 25, 2011 9:46 AMHi,
I'm having a quite annoying problem with a4j:support in the following structure:
{code}
<rich:panel id="ps">
<a4j:region>
<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:selectOneListbox>
<h:message styleClass="error" for="pcs" />
</t:panelGrid>
<ui:repeat var="qsetting" value="#{setting.qSettings}">
<t:panelGrid columns="3">
<h:outputLabel value="#{qsetting.labelText}:"/>
<h:panelGroup>
<h:inputText id="qinputn" value="#{qsetting.value}"/>
</h:panelGroup>
</t:panelGrid>
</ui:repeat>
</ui:repeat>
</mw:panel>
</a4j:region>
</rich:panel>
{/code}
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?
Thanks,
Steven