myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Mitev" <adrian.mi...@googlemail.com>
Subject Re: [Solved] ajax4jsf trouble after a form has failed JSF validation
Date Fri, 09 Mar 2007 17:34:34 GMT
Try with a4j:log and see what's printed there.

2007/3/9, raindogs <codingalex@yahoo.com>:
>
>
> Thanks for the response. I did put the <a4j:outputPanel
> ajaxRendered="true">
> around the h:message tags, but the problem persists. I also tried adding
> the
> t:saveState to the values in the drop-down, but that didn't work either.
>
> I also posted this to the Ajax4Jsf forum on the JBoss site, but anyone
> here
> who can think of another way around this will immediately earn a spot on
> my
> Christmas card list.
>
>
>
>
> Adrian Mitev-2 wrote:
> >
> > 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, Siju.Varghese@equifax.com <Siju.Varghese@equifax.com>:
> >>
> >>
> >> 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 <jbischoff@klkurz.com>*
> >>
> >> 03/08/2007 03:33 PM  Please respond to
> >> "MyFaces Discussion" <users@myfaces.apache.org>
> >>
> >>   To
> >> MyFaces Discussion <users@myfaces.apache.org>  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>
> >> >>
> >> >>
> >> >>
> >> >
> >>
> >>
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/ajax4jsf-trouble-after-a-form-has-failed-JSF-validation-tf3369160.html#a9397483
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message