You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Enrique Medina <e....@gmail.com> on 2005/11/17 01:15:57 UTC

HtmlPanelTabbedPane & Update Model

Hi,

Is there a justification why the broadcast method of the HtmlPanelTabbedPane
calls getFacesContext().renderResponse(), so the model doesn't get updated?
I mean, how can I preserve data from tab changing?

Some time ago someone proposed to extend the component commenting that line
and also the subsequent call to super.broadcast()... Does it make sense? Why
can't the change of a tab update the model? Is it something that I'm
misunderstanding?

Thanks for your support ;-)

Re: HtmlPanelTabbedPane & Update Model

Posted by Simon Kitching <sk...@obsidium.com>.
Enrique Medina wrote:
> Hi,
> 
> Is there a justification why the broadcast method of the 
> HtmlPanelTabbedPane calls getFacesContext().renderResponse(), so the 
> model doesn't get updated? I mean, how can I preserve data from tab 
> changing?
> 
> Some time ago someone proposed to extend the component commenting that 
> line and also the subsequent call to super.broadcast()... Does it make 
> sense? Why can't the change of a tab update the model? Is it something 
> that I'm misunderstanding?
> 
> Thanks for your support ;-)

The tabbed pane effectively is like a single form with multiple "pages" 
within it. The fact that you are changing page doesn't mean you are 
actually *processing* the form, you're just revealing a different part 
of the form to the user.

The data entered by the user isn't lost, it just remains in the 
component rather than being pushed into the model until some button or 
link that isn't an "immediate" control is used.

If the model is updated, then the validators are run first, and that 
means that you can't change tabs if any field on the current tab doesn't 
pass validation. This is why the "immediate" flag exists, and why the 
tab is calling renderResponse - to allow changes to a page without 
generating error messages for invalid input.

It sounds to me like you want something different: a separate form per 
tab. That can probably be done by building the "tabs" as separate pages 
that each include an identical header bar across the top with the tabs 
in it.

Regards,

Simon