Hi! Sorry for the lengthy mail ... Solving this problem just made me crazy .... so easy problem, and so complicate if not impossible solution with JSF. Everything I toucht in the last couple of days had some side-effect/influence on something else.
My simple "country/zip immediate show city" ppr problem drives me crazy. I wonder why no one else wanted to solve that the nice way. To sum up: You have a form with a couple of input fields, some of them required. The field triple country/zip/city (within the form) should behave as follows: *) after country change -> lookup and show city *) after zip change -> lookup and show city *) allow to manually override the city *) reset manually override city to automatich mode (using a special commandLink) After my latest changes to the ppr stuff I made things work, but not as nicely as I wanted it to be - depending on the concrete view layout. The most annoying things I experienced lately are: 1) the inlineMessage make the form not work correctly if the message is going to replace one of the input controls ... means .... the value of this field will not be transmitted (I can live without inlineMessage ...) 2) without inlineMessage, if the focus is within the city field, after ppr the focus is lost (the input field has been readded to the form) and you have to use the mouse to reset it. 3) The view (follows later) just looks ugly with some "hacks" (hidden command buttons to make submitOnEvent happy) The problem 2 is the one currently struggling me. As far as I know it is not possible to get the element with the current focus. If I would like to solve this problem, it seems if have to a) attach an onfocus()/onblur() handler to each and every input element and track the focus that way. You probably know how bad such things interact with user supplied javascript (-1) b) probably make the ajax call synchron which should hopefully avoid the focus problem (+0) c) get rid of this way at all (personally I don't like it to transfer the whole component just to update the value) and introduce something different at all (+1 I think) Long story .... Don't you think too that something like Shale Remoting (with a nicer javascript client API) would be more helpful here? You can solve that problem then easily and it should do the trick too. What do you think? Do you know any nice looking implementation of such a thing? On java.net there is one (mabon), but it looks like it uses dojo which then again will introduce some conflicts with the tomahawk-sandbox dojo. Some javascript which again updates only the specific model fields and executed a method then where you can use the return value in javascript then again. Something like: // invoke(method, form-to-use, fields-to-send-and-process, return-values-to-gather-from) var returnArray[] = BackingBeanExecutor.invoke("#{backingBeanName.method}", "form", {"country", "zip"}, {"city"}) formField.value=returnArray[0]; In contrast to other remoting implementations this will really update the model data and gather the value again from the components. Thus, the converter/validation stuff will happen here too. Ideas? Ciao, Mario For those interested - the current view snipped: <h:outputLabel for="land" value="Land"/> <h:selectOneMenu id="land" value="#{prCustomerRegistration.land}" required="true"> <f:selectItems value="#{prCustomerRegistration.laender}"/> <s:submitOnEvent event="change" for="searchCity"/> </h:selectOneMenu> <h:outputLabel for="plz" value="Plz"/> <h:panelGroup> <h:inputText id="plz" value="#{prCustomerRegistration.plz}" size="5" maxlength="5" required="true"> <s:submitOnEvent event="change" for="searchCity"/> </h:inputText> <h:outputText value=" Ort "/> <s:pprPanelGroup partialTriggers="searchCity,searchCityOverride,searchCityReset"> <h:inputText id="ort" value="#{prCustomerRegistration.ort}" size="30" maxlength="40"> <s:submitOnEvent event="change" for="searchCityOverride"/> </h:inputText> <s:pprSubmit processComponentIds="land,plz,ort"> <h:commandLink id="searchCityReset" action="#{prCustomerRegistration.searchCityResetAction}" rendered="#{!prCustomerRegistration.useOrtAutomatic and not empty prCustomerRegistration.ortAutomatic and prCustomerRegistration.ort ne prCustomerRegistration.ortAutomatic}"> <h:outputText value="Ort '#{prCustomerRegistration.ortAutomatic}' übernehmen."/> </h:commandLink> </s:pprSubmit> </s:pprPanelGroup> <s:pprSubmit processComponentIds="land,plz,ort"> <h:commandButton id="searchCityOverride" value="searchCityOverride" action="#{prCustomerRegistration.searchCityOverrideAction}" style="display:none;"/> <h:commandButton id="searchCity" value="searchCity" action="#{prCustomerRegistration.searchCityAction}" style="display:none;"/> </s:pprSubmit> </h:panelGroup>