I've been reading your post, but I think I'm missing something...
If you set immediate=false, then only two phases will be executed:
1) Restore view
2) Apply request values
so, as you correctly say, the model will not be updated, as the "Update Model" phase is not invoked.
But AFAIK one thing is the component and another is the model. I mean, the component must be always updated independently of the value for the immediate attribute, so I don't understand why you loose your component values between requests (maybe it's just a matter of scope, and not really the immediate attribute).
Just my 2 cents ;-)
2005/8/24, Richard Wallace <[EMAIL PROTECTED]>:
James Reynolds wrote:
>Ooo! I know this one!
>
>I lean heavily on the Core JSF book by Geary & Horstmann, there is some
>good info on this in the page life cycle in Chapter 7. Specifically,
>the Immediate Components information on page 292. As you mentioned, the
>immediate attribute must be set to true for your components. The
>portion I tripped up on was adding "context.renderResponse ();" at the
>end of my ValueChangeEvent code for the valueChangeListener. Then, the
>model maintained the previous state of my page without firing
>validation.
>
>
>
The problem with that is that then the model doesn't get updated when
the command link is clicked so on the page they get directed to can't
preserve the model info cause it was never updated. The situation I
have in mind is something like:
The user loads the page. They enter some contact info. They click on
one of the command links. The contact info shouldn't be validated but
the model values should be udpated. If you look at the lifecycle the
validation occurs before updating the model values. And immediate event
handling gets handled before validation. So, if I set the immediate
attribute to true it will forward to the "quick add" page before
validating the data or updating the model. So <t:saveState> will be
preserving old information, not the latest info the user entered.
>JR
>
>-----Original Message-----
>From: Richard Wallace [mailto:[EMAIL PROTECTED] ]
>Sent: Wednesday, August 24, 2005 10:14 AM
>To: MyFaces Discussion
>Subject: Bypassing validation while still preserving values
>
>Hey everyone,
>
>I've got a form that has a couple of optional command links on it. They
>are basically "quick add" buttons so a user can quickly add things to
>drop downs if they aren't there. When these "quick add" buttons are
>clicked the user is sent to an add page, the user enters the new info
>and is then redirected back to the original page where the new entry is
>selected and all the other data is preserved from before they clicked
>the "quick add" button. The backing beans involved are request scoped
>and the values filled in before clicking the "quick add" button are
>preserved through the process using the <t:saveState> element.
>
>I'm trying to get the validation correct. I want all the form elements
>to be required when the user clicks the submit button, but when they hit
>
>the "quick add" link the validation should be bypassed. I thought of
>doing this with the immediate attribute set to true on the "quick add"
>command links but if I do that then any data the user entered on that
>page load (contact info type stuff) is lost. So I kind of need to
>bypass the validation but still update the model values if one of the
>command links are clicked, but have full validation done when the
>command button is pressed.
>
>I was looking at the new OptionalValidation Framework but I'm not sure
>exactly how to apply it in this case. I mean, what I really want is to
>have the validation type be none when command links are used and hard
>otherwise.
>
>Any ideas?
>
>Thanks,
>Rich
>
>
>

