You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rafael Nami <ra...@gmail.com> on 2005/10/24 15:22:05 UTC

skip validation

Hi everyone.
I know that it can be a silly question, but how can I, with a commandButton,
post a form to a page, skipping validation and conversion phase, BUT
EXECUTING the update bean values phase?
I was trying this code in the method:

*FacesContext fc = FacesContext.getInstance();*
*UIViewRoot vr = facesContext.getViewRoot();*
*vr.processUpdate(facesContext);*
*fc.renderResponse();*
*return VIEW_ANEXOS;*
**
But with this the update values phase isn't being executed. In the jsp page
I'm simply adding a immediate="true" to avoid the validation and conversion
phase.
 What's wrong in my approach?
 Thanks in advance
 Best Regards
 Rafael Mauricio Nami

Re: skip validation

Posted by Rafael Nami <ra...@gmail.com>.
Thanks Mike.

2005/10/24, Mike Kienenberger <mk...@gmail.com>:
>
> By default, you cannot do this. You can't update beans with data if
> the data hasn't been converted and validated first.
>
> However, you can use the OptionalValidationFramework to selectively
> skip conversion/validation/update for certain fields. This might help
> you, but you can still only expect updates for fields that pass
> conversion and validation.
>
> http://wiki.apache.org/myfaces/OptionalValidationFramework
>
> Note that this framework is experimental. I'm hoping that we'll be
> able to have a 1.0 release in a week or two, but you'll need to grab
> it from CVS for now.
>
> Your other option is that you can read the unconverted/unvalidated
> values directly from your components using
> "component.getSubmittedValue()".
>
> -Mike
>
> On 10/24/05, Rafael Nami <ra...@gmail.com> wrote:
> > Hi everyone.
> > I know that it can be a silly question, but how can I, with a
> commandButton,
> > post a form to a page, skipping validation and conversion phase, BUT
> > EXECUTING the update bean values phase?
> > I was trying this code in the method:
> >
> > FacesContext fc = FacesContext.getInstance();
> > UIViewRoot vr = facesContext.getViewRoot();
> > vr.processUpdate(facesContext);
> > fc.renderResponse();
> > return VIEW_ANEXOS;
> >
> > But with this the update values phase isn't being executed. In the jsp
> page
> > I'm simply adding a immediate="true" to avoid the validation and
> conversion
> > phase.
> >
> > What's wrong in my approach?
> >
> > Thanks in advance
> >
> > Best Regards
> >
> > Rafael Mauricio Nami
>

Re: skip validation

Posted by Mike Kienenberger <mk...@gmail.com>.
By default, you cannot do this.  You can't update beans with data if
the data hasn't been converted and validated first.

However, you can use the OptionalValidationFramework to selectively
skip conversion/validation/update for certain fields.  This might help
you, but you can still only expect updates for fields that pass
conversion and validation.

http://wiki.apache.org/myfaces/OptionalValidationFramework

Note that this framework is experimental.   I'm hoping that we'll be
able to have a 1.0 release in a week or two, but you'll need to grab
it from CVS for now.

Your other option is that you can read the unconverted/unvalidated
values directly from your components using
"component.getSubmittedValue()".

-Mike

On 10/24/05, Rafael Nami <ra...@gmail.com> wrote:
> Hi everyone.
> I know that it can be a silly question, but how can I, with a commandButton,
> post a form to a page, skipping validation and conversion phase, BUT
> EXECUTING the update bean values phase?
> I was trying this code in the method:
>
> FacesContext fc = FacesContext.getInstance();
> UIViewRoot vr = facesContext.getViewRoot();
> vr.processUpdate(facesContext);
> fc.renderResponse();
> return VIEW_ANEXOS;
>
> But with this the update values phase isn't being executed. In the jsp page
> I'm simply adding a immediate="true" to avoid the validation and conversion
> phase.
>
> What's wrong in my approach?
>
> Thanks in advance
>
> Best Regards
>
> Rafael Mauricio Nami