myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Korherr <jakob.korh...@gmail.com>
Subject Re: Way to prevent further validations in the listener?
Date Mon, 15 Mar 2010 17:19:15 GMT
Ok cool. The implications are that your action methods and your action
listeners are not invoked in that request! Also, and I forgot that before,
your submitted values are not applied to your managed beans, because
UPDATE_MODEL is also not invoked.

But this is anyway the expected JSF behavior if a validation fails.

Regards,
Jakob

2010/3/15 laredotornado <laredotornado@gmail.com>

>
> Skipping the entire validation phase would work for me here.  However, what
> are the implications of also skipping the INVOKE_APPLICATION phase?
>
> Thanks, - Dave
>
>
>
> Jakob Korherr wrote:
> >
> > Hi,
> >
> > Do you want to skip the entire validation phase or do just want to
> disable
> > some specific validators?
> >
> > In the first case you can set FacesContext.renderResponse(), however also
> > the INVOKE_APPLICATION phase will be skipped here.
> > In the second case you could set a value in the FacesContext's attribute
> > Map
> > and consider this value in your validators to either skip or do the
> > validation.
> >
> > I think these are the best solutions to your problem in MyFaces 1.1. In
> > MyFaces 2.0 the attribute "disabled" was added to <f:converter>. This
> > would
> > perfectly fit you in this scenario, but unfortunately this is not
> > available
> > in 1.1.
> >
> > Hope this helps!
> >
> > Regards,
> > Jakob
> >
> > 2010/3/15 laredotornado <laredotornado@gmail.com>
> >
> >>
> >> Hi,
> >>
> >> I'm using MyFaces 1.1.5 with Tomahawk 1.1.7.  I have a phase listener
> and
> >> was wondering if there is a way I can prevent validations from happening
> >> if
> >> certain conditions occur.  For example, if I reach the branch with the
> >> comment ...
> >>
> >>        public void beforePhase(final PhaseEvent phaseEvent) {
> >>                if (phaseEvent.getPhaseId() ==
> >> PhaseId.PROCESS_VALIDATIONS)
> >> {
> >>                        if (errorsOccur(phaseEvent)) {
> >>                                // Prevent other validations from
> >> happening.
> >>                        }   // if
> >>                } // if
> >>        }
> >>
> >> I would like to prevent the validations from taking place in this text
> >> field
> >> ...
> >>
> >>                <h:inputText id="domeTourNumber_of_Adults"
> >> value="#{domeTour.numAdults}"
> >>                                            required="true"
> >>                                            size="60"
> >>                                            maxlength="60"
> >>                                            styleClass="textFields
> >> numAdultsField">
> >>                <f:validator validatorId="TourNumberValidator" />
> >>                <f:validator validatorId="TourTotalPeopleValidator" />
> >>                <f:validator validatorId="TourAdultChildRatioValidator"
> />
> >>               </h:inputText>
> >>
> >> Any insights you can provide are greatly appreciated, - Dave
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Way-to-prevent-further-validations-in-the-listener--tp27905462p27905462.html
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Way-to-prevent-further-validations-in-the-listener--tp27905462p27907138.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message