The h:message/h:messages component is not rendering anything if there is no error message and that's why it cannot be rerendered if there is an error message (this is the most possible reason for your action method not to be invoked). Nest the h:message tag into <a4j:outputPanel ajaxRendered="true"> like this:
<a4j:outputPanel ajaxRendered="true"> <h:message for="addressName" /> </a4j:outputPanel> 2007/3/8, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
I too had this problem, in my case the managed bean was in request scope. I did a t:saveState on the select item list and it solved the problem. -Siju *Jeff Bischoff <[EMAIL PROTECTED]>* 03/08/2007 03:33 PM Please respond to "MyFaces Discussion" <[email protected]> To MyFaces Discussion <[email protected]> cc Subject Re: [Solved] ajax4jsf trouble after a form has failed JSF validation Raindog, I would ask in the new ajax4jsf forum. See [1]. [1] http://jboss.com/index.html?module=bb&op=viewforum&f=259 raindogs wrote: > One other thing... it occurred to me that I could probably bypass any > complications from JSF validation by adding immediate="true" to the > "a4j:support" tag. The method did fire when I did this, but the elements > defined in "rerender" did not refresh. I'm sure the solution is in here > somewhere, but I'm just not seeing it. > > > > raindogs wrote: >> I'm having a problem getting ajax4jsf to play nice with jsf form >> validation. The page below uses ajax4jsf to run a method from the bean >> when the value in the "state" list changes and update a couple of fields. >> This works great under most circumstances. However, if the user submits >> the form *without* filling in the required "addressName" field, the form >> does not submit and the error message is displayed. This is as it should >> be. The trouble comes when, if the form has been submitted and is >> displaying the error message for the "addressName" field, the user changes >> the "state" field, which should still fire off the "loadState" method. In >> this case, the "loadState" method never fires and none of the fields in >> the "reRender" list are refreshed, even if there is now a value in the >> "addressname" field. The snippet below should show all of the relvant >> code, any help would be much appreciated. >> >> Thanks, >> Alex >> >> >> <s:subForm id = "locationSubForm"> >> <h:panelGroup id="locationGroup"> >> <h:panelGrid columns="2" style="margin-top:10px;" id="locationGrid" >> border="0" cellpadding="2"> >> >> <h:outputText value="Address Name:" /> >> <h:inputText id="addressName" value="#{locationForm.addressName}" >> required="true"/> >> >> <h:message for="addressName" /> >> <h:outputText value="" /> >> >> <h:outputText value="Street Address:" /> >> <h:inputText id="streetAddress" value="#{locationForm.streetAddress}" >> /> >> >> <h:outputText value="City:" /> >> <h:inputText id="city" value="#{locationForm.city}" /> >> >> <h:outputText value="State:" /> >> >> <h:selectOneMenu value="#{locationForm.state}" >> style="padding:0px;margin:0px;"> >> <a4j:support event="onchange" action="#{locationForm.loadState}" >> reRender="latitude, longitude, city, zipcode" ajaxSingle="true"/> >> <f:selectItems value ="#{locationForm.stateList}" /> >> </h:selectOneMenu> >> >> ... >> >> <t:commandButton action="#{locationForm.submitNewLocation}" >> value="Submit" actionFor="locationSubForm"/> >> <h:outputText value=" " escape="false"/> >> </h:panelGrid> >> </h:panelGroup> >> </s:subForm> >> >> >> >

