I’ve got a form which has a domain model with some JSR-303 validation beans. Now I would like to include a “Save draft” feature without any validation. If I set immediate=true on my corresponding commandButton validation is skipped but also the form submit.
Is there a way to update the model in my save draft action?
Use
<f:validateBean>where on you set thedisabledattribute.If this evaluates
true, this will skip all bean validation on the property associated with the input’s value. You should only ensure that theboolean draftproperty is set before the validations phase takes place. E.g.with
or if it’s a view scoped bean on which
@ManagedPropertywon’t work:Another way is to check in EL if the button is pressed by determining the presence of its parameter name. For example, with the following form and button ID