You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dave Brondsema <da...@brondsema.net> on 2006/01/19 16:23:10 UTC

do conversion and update model values, but skip validation?

I need to implement a "Save as Draft" button for a page I'm working on.
 I want to save all the data in the model, so I need to convert values
to the right data type and update the model values.  But I do not want
to do any other validation.  Is this possible?  immediate="true" skips
too much.  Can I use a phase listener before and after validation to do
this somehow?  Or perhaps I have to use immediate="true" and then invoke
some lifecycle methods in my saveAsDraft() backing bean method?

Any suggestions?

thanks,

-- 
Dave Brondsema
Software Developer
Cornerstone University

Re: do conversion and update model values, but skip validation?

Posted by Dave <ja...@yahoo.com>.
I think JSF need a flag for submitting a form. This flag tells JSF framework whether to skip phases after applying local values, but these local values will display back. One use case is:  country/state. When a user selects a country, the select items for state need to be changed (a round trip currently).

Dave Brondsema <da...@brondsema.net> wrote:  Dave Brondsema wrote:
> I need to implement a "Save as Draft" button for a page I'm working on.
> I want to save all the data in the model, so I need to convert values
> to the right data type and update the model values. But I do not want
> to do any other validation. Is this possible? immediate="true" skips
> too much. Can I use a phase listener before and after validation to do
> this somehow? Or perhaps I have to use immediate="true" and then invoke
> some lifecycle methods in my saveAsDraft() backing bean method?
> 
> Any suggestions?
> 
> thanks,
> 

To answer my own questions, immediate="true" on the "Save as DRAFT"
button means that it is processed before anything else, so the other
data isn't even available. Explained in detail at
http://wiki.apache.org/myfaces/How_The_Immediate_Attribute_Works

It looks like I can do what I need by using
http://wiki.apache.org/myfaces/OptionalValidationFramework but
unfortunately that requires significant changes to all my forms that
need "save as draft" functionality.

-- 
Dave Brondsema
Software Developer
Cornerstone University



		
---------------------------------
Yahoo! Photos – Showcase holiday pictures in hardcover
 Photo Books. You design it and we’ll bind it!

Re: do conversion and update model values, but skip validation?

Posted by Dave Brondsema <da...@brondsema.net>.
Dave Brondsema wrote:
> I need to implement a "Save as Draft" button for a page I'm working on.
>  I want to save all the data in the model, so I need to convert values
> to the right data type and update the model values.  But I do not want
> to do any other validation.  Is this possible?  immediate="true" skips
> too much.  Can I use a phase listener before and after validation to do
> this somehow?  Or perhaps I have to use immediate="true" and then invoke
> some lifecycle methods in my saveAsDraft() backing bean method?
> 
> Any suggestions?
> 
> thanks,
> 

To answer my own questions, immediate="true" on the "Save as DRAFT"
button means that it is processed before anything else, so the other
data isn't even available.  Explained in detail at
http://wiki.apache.org/myfaces/How_The_Immediate_Attribute_Works

It looks like I can do what I need by using
http://wiki.apache.org/myfaces/OptionalValidationFramework but
unfortunately that requires significant changes to all my forms that
need "save as draft" functionality.

-- 
Dave Brondsema
Software Developer
Cornerstone University