You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Cristi Toth <cr...@gmail.com> on 2006/12/18 09:41:41 UTC

Submitting a form on tab switching

Hi,

I am using a <t:panelTabbedPane> with serverSideTabSwitch turned on
I have some input fields on a tab and others on another tab.
If I enter some data into the first tab's fields,
then switch to the other tab and then submit the form,
the first tab's data is not submitted!!!
How to make the tab switching submit the form? (like an immediate="false")

And another curious thing on tabs:
I have some data shown on a tab (not the first tab) and
I want it loaded (from DB) only when the tab is shown.
So I load the data in the getter of a property of a field in that tab.
But the getter is called up even if the tab is not yet shown and
serverSideTabSwitch is turned on!!!
Why?

Thanks for any help!
Cristi

Re: Submitting a form on tab switching

Posted by mjovanov <mi...@jpmchase.com>.
Hi I have the same problem: my form fields are spread out across multiple
tabs and I would like to be able to submit them all when the submit button
is pressed.  I too have the panelTabbedPane nested inside a form tag and a
Submit button outside of the panelTabbedPane but inside the form tag.

Any updates on this issue?!
-- 
View this message in context: http://www.nabble.com/Submitting-a-form-on-%3Ct%3ApanelTabbedPane%3E-tab-switching-tf2838600.html#a8015151
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Submitting a form on tab switching

Posted by Cristi Toth <cr...@gmail.com>.
Hi Paul,

3)My backing-bean has request scope indeed , but I use <t:saveState> on that
page.
1)The tabs and the button are already in the form.
I forgot to mention that the submit button is out of the tabbed panel, so I
can click it no matter what tab is selected.
So in fact, what I want is to be able to submit the data from within all the
tabs, when I click the submit button.
For example: I enter some data into the first tab, go to the second one and
enter some data, then submit.
And I want the first tab's data to be submitted too (probably when the tab
is switched).

Thanks for helping!

Cristi

On 12/18/06, Paul Spencer <pa...@apache.org> wrote:
>
> Cristi,
> Below are some correction to my previous response and additional
> information.
>
> Paul Spencer wrote:
> > Cristi,
> >
> > See below.
> >
> > Cristi Toth wrote:
> >> Hi,
> >>
> >> I am using a <t:panelTabbedPane> with serverSideTabSwitch turned on
> >> I have some input fields on a tab and others on another tab.
> >> If I enter some data into the first tab's fields,
> >> then switch to the other tab and then submit the form,
> >> the first tab's data is not submitted!!!
> >> How to make the tab switching submit the form? (like an
> >> immediate="false")
> >
> > Try:
> > 1) Putting the tabs in the form
> > 2) Putting the submit buttons outside the form.  Use the
> >    buttons "render" attribute to control when it is displayed.
> >
> #2 is optional.  The submit button can be on a form.
>
> 3) What is the scope of the managed bean, I suspect it is request.
>    In that case you can either change the scope of the bean, or use
>    a dialog manager like Shale's dialog manager[1].
>
> >>
> <snip>
> >> Thanks for any help!
> >> Cristi
> >>
> >>
> >
> > Paul Spencer
> >
>
> Paul Spencer
>
> [1] http://shale.apache.org/shale-dialog/index.html
>

Re: Submitting a form on tab switching

Posted by Paul Spencer <pa...@apache.org>.
Cristi,
Below are some correction to my previous response and additional information.

Paul Spencer wrote:
> Cristi,
> 
> See below.
> 
> Cristi Toth wrote:
>> Hi,
>>
>> I am using a <t:panelTabbedPane> with serverSideTabSwitch turned on
>> I have some input fields on a tab and others on another tab.
>> If I enter some data into the first tab's fields,
>> then switch to the other tab and then submit the form,
>> the first tab's data is not submitted!!!
>> How to make the tab switching submit the form? (like an 
>> immediate="false")
> 
> Try:
> 1) Putting the tabs in the form
> 2) Putting the submit buttons outside the form.  Use the
>    buttons "render" attribute to control when it is displayed.
> 
#2 is optional.  The submit button can be on a form.

3) What is the scope of the managed bean, I suspect it is request.
    In that case you can either change the scope of the bean, or use
    a dialog manager like Shale's dialog manager[1].

>>
<snip>
>> Thanks for any help!
>> Cristi
>>
>>
> 
> Paul Spencer
> 

Paul Spencer

[1] http://shale.apache.org/shale-dialog/index.html

Re: Submitting a form on tab switching

Posted by Paul Spencer <pa...@apache.org>.
Cristi,

See below.

Cristi Toth wrote:
> Hi,
> 
> I am using a <t:panelTabbedPane> with serverSideTabSwitch turned on
> I have some input fields on a tab and others on another tab.
> If I enter some data into the first tab's fields,
> then switch to the other tab and then submit the form,
> the first tab's data is not submitted!!!
> How to make the tab switching submit the form? (like an immediate="false")

Try:
1) Putting the tabs in the form
2) Putting the submit buttons outside the form.  Use the
    buttons "render" attribute to control when it is displayed.

> 
> And another curious thing on tabs:
> I have some data shown on a tab (not the first tab) and
> I want it loaded (from DB) only when the tab is shown.
> So I load the data in the getter of a property of a field in that tab.
> But the getter is called up even if the tab is not yet shown and
> serverSideTabSwitch is turned on!!!
> Why?

In general getters are called may time, even when the element is NOT
rendered. The "why" is defined in the JSF spec.  In short, limit
the amount of work done in getters.  In many cases the work can be
moved to listeners.

> 
> Thanks for any help!
> Cristi
> 
> 
> ------------------------------------------------------------------------
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.432 / Virus Database: 268.15.22/590 - Release Date: 12/16/2006 5:39 PM

Paul Spencer