myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murat Hazer" <muratha...@gmail.com>
Subject Re: Help: "Ignore" validation and still update model?
Date Mon, 12 Jun 2006 01:37:01 GMT
AFAIK to exceute update model phase you can call processUpdate(facesContext)
func. in the validator method ie:

public void validateAddress(FacesContext facesContext,
            UIComponent component, Object objectToValidate)
            throws ValidatorException {
        .......
        this.addressModel.processUpdates(facesContext);
        .....
}

regards....

On 6/12/06, Andrew Robinson <andrew.rw.robinson@gmail.com> wrote:
>
> Okay, I am having an issue for a non-standard configuration (go
> figure, I think I am in the "20%" just about 80% of the time) and am
> looking for help.
>
> I think what I have to do is continue to the update model phase even
> when validation fails, but I'll tell you what I am doing in case
> anyone has a better idea.
>
> I have a register user form. It has three child tables (t:dataTable)
> one for each of: email addresses, phone numbers and geographic
> addresses. I have done it this way so that the user can enter multiple
> emails, phone numbers and addresses (for example, a work phone, a cell
> phone, etc). These tables are backed by Hibernate configured lists (so
> I have a FK child tables to store these records for the user table).
>
> In my view, I have "Add" and "Delete" buttons for the tables (and rows
> in the table). I don't care when the user clicks and add or a delete
> if components are invalid within the page (I only care when they click
> the "Register" for new users or "Save" for existing users).
>
> I tried marking the command links as immediate, but as those familiar
> with JSF would know, opened a can of worms. Since data tables do not
> support submitted values in child components, the user's data from the
> data tables disappeared when the view was re-rendered. So a no-go
> there.
>
> So I really need the update model phase to complete. (Yes one solution
> would be to enable AJAX for this project and only refresh the table
> row for the add or the delete, but that is beyond my scope for this
> project).
>
> Is there a way to let validation happen, but regardless of validation
> errors and warnings, to go ahead and update the model and execute the
> action?
>
> I suppose I could use a sub-form from the sandbox, but would that not
> cause the input fields in the other tables to loose their values
> anyways since validate and updating of the model does not take place
> for non-subform fields (I haven't tried the sub form out yet although
> it sounds like a good idea)?
>
> Another option may be to use a custom component that would update the
> value during the validation phase, but not stop the life cycle (so
> that the validation still occurs, and the values would still be kept
> for data table rows). I think that will work (didn't think it through
> fully yet), but it is messy (Basically a commandLink that doesn't use
> ActionEvent, but a custom event that does it's work during broadcast
> of process validators or apply request values).
>
> Anyone have a bright idea to get around this solution?
>
> Thank you
> -Andrew
>
> PS - also is there any way without partial page refreshing that
> inputSecret fields can not loose their value when the view is
> re-rendered (maybe by sending a static "fake" value down to the client
> that says to use the last value and then store that "last value" in
> the user's session?)?
>



-- 
Murat HAZER
Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer/

Mime
View raw message