You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Yu...@muranosoft.com on 2006/03/23 17:21:14 UTC

Skip Validation Phase

Hi, All!!!

 

I've confused with it in JSF. I have some validation logic on my form:

 

2 textboxes which have required attribute

And also one drop-down ( I used immediate=true, because I don't want to run
validation before valueChangeListener ).

In my valueChangeListener I tried to ignore validation phase at all, so in
the end of this method I called
FacesContext.getCurrentInstance().renderResponse();

Here is code:

    public void vendorChanged(ValueChangeEvent event) {

        FacesContext context = FacesContext.getCurrentInstance();

        String value = (String) event.getNewValue();

        if (value != null) {

            . updating bean data, I expected that data will be appear on my
page

        }

        context.renderResponse();

    }

 

But when this valueChangeListener finished data isn't updates on the my
page? Why? Any ideas?

 

Thanks in advance,

Yura.


Re: Skip Validation Phase

Posted by Mike Kienenberger <mk...@gmail.com>.
My first attempt to solve such a problem was to create the
OptionalValidationFramework discussed on the wiki, but I don't really
like that approach.   It worked for me because I had a lot of
dropdowns on the page.

You might take a look at using the Sandbox subform validation as an
alternate way to do optional validation.

If you have only a few components that need to work like this, you
could manually perform the update model phase yourself.    I haven't
tried it, but you might be able to call component.processUpdates() in
your handler.

Otherwise, you can manually grab the submitted or validated local
value from the component, and manually put it into the backing bean.


On 3/23/06, Yura.Tkachenko <Yu...@muranosoft.com> wrote:
>
> Ok, Thanks. Do you know any solution which will be usefull for me?
>
> Thanks,
> Yura.
>
> -----Original Message-----
> From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> Sent: Thursday, March 23, 2006 6:42 PM
> To: MyFaces Discussion
> Subject: Re: Skip Validation Phase
>
> On 3/23/06, Yura.Tkachenko@muranosoft.com
> > I know this, but for skip validation phase I'm using call:
> >          FacesContext context = FacesContext.getCurrentInstance();
> >          context.renderResponse();
>
> I guess I was too subtle.
>
> You're not skipping just the validation phase.   You're skipping all
> phases after ApplyValues, including UpdateModel.  Your backing beans
> will not be updated.
>
>

RE: Skip Validation Phase

Posted by "Yura.Tkachenko" <Yu...@muranosoft.com>.
Ok, Thanks. Do you know any solution which will be usefull for me?

Thanks,
Yura.

-----Original Message-----
From: Mike Kienenberger [mailto:mkienenb@gmail.com] 
Sent: Thursday, March 23, 2006 6:42 PM
To: MyFaces Discussion
Subject: Re: Skip Validation Phase

On 3/23/06, Yura.Tkachenko@muranosoft.com
> I know this, but for skip validation phase I'm using call:
>          FacesContext context = FacesContext.getCurrentInstance();
>          context.renderResponse();

I guess I was too subtle.

You're not skipping just the validation phase.   You're skipping all
phases after ApplyValues, including UpdateModel.  Your backing beans
will not be updated.


Re: Skip Validation Phase

Posted by Mike Kienenberger <mk...@gmail.com>.
On 3/23/06, Yura.Tkachenko@muranosoft.com
> I know this, but for skip validation phase I'm using call:
>          FacesContext context = FacesContext.getCurrentInstance();
>          context.renderResponse();

I guess I was too subtle.

You're not skipping just the validation phase.   You're skipping all
phases after ApplyValues, including UpdateModel.  Your backing beans
will not be updated.

RE: Skip Validation Phase

Posted by Yu...@muranosoft.com.
I know this, but for skip validation phase I'm using call:

         FacesContext context = FacesContext.getCurrentInstance();

         context.renderResponse();

 

Thanks,

Yura.

-----Original Message-----
From: Mike Kienenberger [mailto:mkienenb@gmail.com] 
Sent: Thursday, March 23, 2006 6:26 PM
To: MyFaces Discussion
Subject: Re: Skip Validation Phase

 

Short answer: immediate doesn't skip validation phase.

 

Long answer:

 

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

 

 

On 3/23/06, Yura.Tkachenko@muranosoft.com <Yu...@muranosoft.com>
wrote:

> 

> 

> 

> Hi, All!!!

> 

> 

> 

> I've confused with it in JSF. I have some validation logic on my form:

> 

> 

> 

> 2 textboxes which have required attribute

> 

> And also one drop-down ( I used immediate=true, because I don't want to
run

> validation before valueChangeListener ).

> 

> In my valueChangeListener I tried to ignore validation phase at all, so in

> the end of this method I called

> FacesContext.getCurrentInstance().renderResponse();

> 

> Here is code:

> 

>     public void vendorChanged(ValueChangeEvent event) {

> 

>         FacesContext context = FacesContext.getCurrentInstance();

> 

>         String value = (String) event.getNewValue();

> 

>         if (value != null) {

> 

>             . updating bean data, I expected that data will be appear on
my

> page

> 

>         }

> 

>         context.renderResponse();

> 

>     }

> 

> 

> 

> But when this valueChangeListener finished data isn't updates on the my

> page? Why? Any ideas?

> 

> 

> 

> Thanks in advance,

> 

> Yura.


Re: Skip Validation Phase

Posted by Mike Kienenberger <mk...@gmail.com>.
Short answer: immediate doesn't skip validation phase.

Long answer:

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


On 3/23/06, Yura.Tkachenko@muranosoft.com <Yu...@muranosoft.com> wrote:
>
>
>
> Hi, All!!!
>
>
>
> I've confused with it in JSF. I have some validation logic on my form:
>
>
>
> 2 textboxes which have required attribute
>
> And also one drop-down ( I used immediate=true, because I don't want to run
> validation before valueChangeListener ).
>
> In my valueChangeListener I tried to ignore validation phase at all, so in
> the end of this method I called
> FacesContext.getCurrentInstance().renderResponse();
>
> Here is code:
>
>     public void vendorChanged(ValueChangeEvent event) {
>
>         FacesContext context = FacesContext.getCurrentInstance();
>
>         String value = (String) event.getNewValue();
>
>         if (value != null) {
>
>             … updating bean data, I expected that data will be appear on my
> page
>
>         }
>
>         context.renderResponse();
>
>     }
>
>
>
> But when this valueChangeListener finished data isn't updates on the my
> page? Why? Any ideas?
>
>
>
> Thanks in advance,
>
> Yura.