Discussion:
tabbed pane problem
Werner Punz
2005-05-27 14:19:30 UTC
Permalink
Hi...

Hi have following problem:
I have a form with lots of entry fields, in the form there is a tabbed
pane with four tabs all of them containing fields.
No when i open the page, the fields are set correctly
in the fields outside the tab and in the first tab, but as soon as I
switch tabs nothing else is shown anymore.
To the worse I lose most of the data referenced by those fields.

Does anybody know what happens there.
I will try to isolate the problem in the evening, to have further details.

Werner
Werner Punz
2005-05-27 14:39:56 UTC
Permalink
Post by Werner Punz
Hi...
I have a form with lots of entry fields, in the form there is a tabbed
pane with four tabs all of them containing fields.
No when i open the page, the fields are set correctly
in the fields outside the tab and in the first tab, but as soon as I
switch tabs nothing else is shown anymore.
To the worse I lose most of the data referenced by those fields.
Does anybody know what happens there.
I will try to isolate the problem in the evening, to have further details.
It seems to me that the tabbed pane simply does not update any model
data or submits the enclosing form correctly... hence everything in the
tabbed pane gets lost.
I dont know how to handle this, moving the pane to a panel stack gives
the desired result.
But as I see it the tabbed pane in the current state is quite usless for
form input, if there is no workaround that.
If anybody has solved the problem, I would love to find an answer.
Philipp Ahlner
2005-05-27 16:07:39 UTC
Permalink
Hi Werner!

You should enclose your x:tabbedPane - tag in a x:form like this:

<h:form>
<x:panelTabbedPane>
<x:panelTab id="tab1">
.....
</x:panelTab>

<x:panelTab id="tab2">
.....
</x:panelTab>
<x:panelTabbedPane>
</h:form>

and not a form per tab. This doesn't work, because the values on every
tab are submited if you change the active tab.

HTH
Philipp
Post by Werner Punz
Post by Werner Punz
Hi...
I have a form with lots of entry fields, in the form there is a tabbed
pane with four tabs all of them containing fields.
No when i open the page, the fields are set correctly
in the fields outside the tab and in the first tab, but as soon as I
switch tabs nothing else is shown anymore.
To the worse I lose most of the data referenced by those fields.
Does anybody know what happens there.
I will try to isolate the problem in the evening, to have further details.
It seems to me that the tabbed pane simply does not update any model
data or submits the enclosing form correctly... hence everything in the
tabbed pane gets lost.
I dont know how to handle this, moving the pane to a panel stack gives
the desired result.
But as I see it the tabbed pane in the current state is quite usless for
form input, if there is no workaround that.
If anybody has solved the problem, I would love to find an answer.
Werner Punz
2005-05-27 16:23:36 UTC
Permalink
I have it like that, but there seems to be another problem which causes
this behavior, I will try to isolate the problem to nail it down
whether it is my code or the tabbed pane.

Werner
Post by Philipp Ahlner
Hi Werner!
<h:form>
<x:panelTabbedPane>
<x:panelTab id="tab1">
.....
</x:panelTab>
<x:panelTab id="tab2">
.....
</x:panelTab>
<x:panelTabbedPane>
</h:form>
Philipp Ahlner
2005-05-27 17:37:57 UTC
Permalink
I use the tabbedPanes in a complex project at work. I've fixed a bug
in the tabbedPane:

http://issues.apache.org/jira/browse/MYFACES-214

but this bug is only fixed on trunk (next version) and not in the
actual 1.0.9. Maybe this bug is your problem (I can't really imagine).
Without a example snippet from your JSP, I can't do anything for you.
Post by Werner Punz
I have it like that, but there seems to be another problem which causes
this behavior, I will try to isolate the problem to nail it down
whether it is my code or the tabbed pane.
Werner
Post by Philipp Ahlner
Hi Werner!
<h:form>
<x:panelTabbedPane>
<x:panelTab id="tab1">
.....
</x:panelTab>
<x:panelTab id="tab2">
.....
</x:panelTab>
<x:panelTabbedPane>
</h:form>
Werner Punz
2005-05-27 18:16:02 UTC
Permalink
I will try to isolate the problem in a few days (I currently am in
crunch time :-( )
Implemented the tabbing with a bunch of javascript and css now :-)

That is more elegant anyway than having to have a full round trip for
switching tags.

Werner
Post by Philipp Ahlner
I use the tabbedPanes in a complex project at work. I've fixed a bug
http://issues.apache.org/jira/browse/MYFACES-214
but this bug is only fixed on trunk (next version) and not in the
actual 1.0.9. Maybe this bug is your problem (I can't really imagine).
Without a example snippet from your JSP, I can't do anything for you.
Alexander 'Alfe' Fetke
2005-05-27 16:12:14 UTC
Permalink
Hi, Philipp ...
Post by Philipp Ahlner
<h:form>
<x:panelTabbedPane>
<x:panelTab id="tab1">
.....
</x:panelTab>
<x:panelTab id="tab2">
.....
</x:panelTab>
<x:panelTabbedPane>
</h:form>
This might work but stripping the enclosing form tags would be better
because the tabbed pane does its own form and (as mentioned before) nested
formulars are not supported by HTML.

Alfe

Alexander Fetke
PrismTech (Germany) GmbH
Schoenhauser Allee 6-7, D-10119 Berlin, Germany
Phone: +49-30-440306-34
Fax: +49-30-440306-78
***@prismtech.com
www.xtradyne.com | www.prismtech.com

* XTRADYNE Security Infrastructure - a PRISMTECH Product Line *
Csík Norbert
2005-05-27 19:11:31 UTC
Permalink
Hi!

I think this is becase your backing beans are request scope. When you
display the second tab it is empty, because submitting the page with
the first tab doesn't set those values.

I've implemented a tab change eventlistener, which reloads the request
scope backing bean's data.

It is working fine for me.
Post by Werner Punz
Hi...
I have a form with lots of entry fields, in the form there is a tabbed
pane with four tabs all of them containing fields.
No when i open the page, the fields are set correctly
in the fields outside the tab and in the first tab, but as soon as I
switch tabs nothing else is shown anymore.
To the worse I lose most of the data referenced by those fields.
Does anybody know what happens there.
I will try to isolate the problem in the evening, to have further details.
Werner
--
Norbert Csík
Enrique Medina
2005-05-27 19:16:15 UTC
Permalink
Yes, I experienced that problem with request scoped beans and tabbed
panes. There are several solutions to the problem:

a) Scope the beans as being session scoped
b) Use some kind of object that holds the model of the tabbed beans,
put it in session and inject it to the request scoped beans through
the JSF IoC mechanism
c) Use the <x:saveState> tag

Norbert, I'm interested in your solution. Could you please post it
here or send me the code?

Thanks in advance ;-)
Post by Csík Norbert
Hi!
I think this is becase your backing beans are request scope. When you
display the second tab it is empty, because submitting the page with
the first tab doesn't set those values.
I've implemented a tab change eventlistener, which reloads the request
scope backing bean's data.
It is working fine for me.
Post by Werner Punz
Hi...
I have a form with lots of entry fields, in the form there is a tabbed
pane with four tabs all of them containing fields.
No when i open the page, the fields are set correctly
in the fields outside the tab and in the first tab, but as soon as I
switch tabs nothing else is shown anymore.
To the worse I lose most of the data referenced by those fields.
Does anybody know what happens there.
I will try to isolate the problem in the evening, to have further details.
Werner
--
Norbert Csík
Werner Punz
2005-05-28 09:19:07 UTC
Permalink
Post by Enrique Medina
Yes, I experienced that problem with request scoped beans and tabbed
a) Scope the beans as being session scoped
b) Use some kind of object that holds the model of the tabbed beans,
put it in session and inject it to the request scoped beans through
the JSF IoC mechanism
c) Use the <x:saveState> tag
For the x:saveState you have to implement the Serialization
for the entire object which has to be covered by the tab, am I right?
Enrique Medina
2005-05-28 10:31:14 UTC
Permalink
Yes, you have to ;-)
Post by Werner Punz
Post by Enrique Medina
Yes, I experienced that problem with request scoped beans and tabbed
a) Scope the beans as being session scoped
b) Use some kind of object that holds the model of the tabbed beans,
put it in session and inject it to the request scoped beans through
the JSF IoC mechanism
c) Use the <x:saveState> tag
For the x:saveState you have to implement the Serialization
for the entire object which has to be covered by the tab, am I right?
Werner Punz
2005-05-28 10:53:11 UTC
Permalink
Ok thanks, I am currently thinking about another solution
to the problem which might make x:saveState and Serialisation
obsolete in the long run. Maybe I will find time after the 15th to
implement it.
Sort of what shale does with their dialog system.
The idead would be to have some kind of scope tag
<x:scope value="scopeName" bean="beanName"/>

which puts a bean into a scope for as long as the scope is covered.
As soon as you hit a backend bean with a page outside of the scope
the scope bean is pushed from the session into a sessioned lastScope
variable, which is replaced as soon as the next scope runs out or maybe
at the time the next scope is triggered.
That would resolve following problems at once...
The problems of losing variables at the tabbing level (same goes for
panel stack.
The problem of having to traverse the fields, or to serialize the data
(which is a pain as well)
The problem of having as only solution of keeping variabls global for
certian periods of time, traversal or session holding.
I am not sure however if I can find the time to do this.

(I will donate my components from the last project however as soon as i
am finished here, got the ok from the management yesterday)

Shale does basically the same on framework level with their dialog
system (it does much more, but that one is the most important stuff
IMHO). But that one in my opinion is a good extension on the framework
level and harder to grasp.
Post by Enrique Medina
Yes, you have to ;-)
Werner Punz
2005-05-28 09:06:48 UTC
Permalink
Post by Csík Norbert
Hi!
I think this is becase your backing beans are request scope. When you
display the second tab it is empty, because submitting the page with
the first tab doesn't set those values.
Yes that sounds reasonable they are indeed request scoped.
I think what we need is something, which is already in shale,
some kind of extended scope which is longer than request but shorter
than session.
(What shale does with dialogs)
You basically run into this problem every time you do something
which refreshes the page on the server in a dynamic way.
Post by Csík Norbert
I've implemented a tab change eventlistener, which reloads the request
scope backing bean's data.
I worked around the problem yesterday night, by just implementing in
good ole javascript a few css tabs and a few divs which are triggered
and shown over javascript.
Works flawlessly.
Werner Punz
2005-05-28 09:48:06 UTC
Permalink
Post by Csík Norbert
Hi!
I think this is becase your backing beans are request scope. When you
display the second tab it is empty, because submitting the page with
the first tab doesn't set those values.
Actually the problem is caused by this, in a midnight debugging session
it seemed to me, that only the visible elements get submitted over
the tab change, but the problem itself is much deeper nested, than on
the tabbing pane, I have not debugged into the myfaces code yet, due to
time constraints, but the panel stack follows the same problematic
behavior of not rendering->not passing (another attempt yesterday night
before I settled to a javascript/css combo)

I am not sure if the problem really is fully solvable on component level
to everybodies satisfaction without introducing another bunch of
constructs or moving things to client side only without roundtripping.
Philipp Ahlner
2005-05-28 15:47:59 UTC
Permalink
Post by Werner Punz
Actually the problem is caused by this, in a midnight debugging session
it seemed to me, that only the visible elements get submitted over
the tab change, but the problem itself is much deeper nested, than on
the tabbing pane, I have not debugged into the myfaces code yet, due to
time constraints, but the panel stack follows the same problematic
behavior of not rendering->not passing (another attempt yesterday night
before I settled to a javascript/css combo)
...
This sound like a known (and solved) bug:

http://issues.apache.org/jira/browse/MYFACES-214

Perhaps your problem is solved if you use a nightly build.
Alexander 'Alfe' Fetke
2005-05-27 14:43:02 UTC
Permalink
Hi, Werner ...
I have a form with lots of entry fields, in the form there is a tabbed pane
with four tabs all of them containing fields.
The JSF tabbed panes are implemented using a form themselves. HTML does
not allow forms within forms. Lots of strange things can happen if you do
not honor this aspect.

We had the problem the other way around: We wanted a form within a tabbed
pane. It would have been a special form for uploading files. We did not
succeed in putting it in a tabbed pane at all. Now we are doing the
upload-facility outside the tabbed pane.

In your case, consider whether it is possible to close the outer form just
above the tabbed pane and open a new form just below the tabbed pane.
That would render three independent forms as a result. That should work
(but of course could raise other problems).

Alfe

Alexander Fetke
PrismTech (Germany) GmbH
Schoenhauser Allee 6-7, D-10119 Berlin, Germany
Phone: +49-30-440306-34
Fax: +49-30-440306-78
***@prismtech.com
www.xtradyne.com | www.prismtech.com

* XTRADYNE Security Infrastructure - a PRISMTECH Product Line *
Werner Punz
2005-05-31 09:58:03 UTC
Permalink
Post by Alexander 'Alfe' Fetke
Hi, Werner ...
I have a form with lots of entry fields, in the form there is a tabbed pane
with four tabs all of them containing fields.
The JSF tabbed panes are implemented using a form themselves. HTML does
not allow forms within forms. Lots of strange things can happen if you do
not honor this aspect.
We had the problem the other way around: We wanted a form within a tabbed
pane. It would have been a special form for uploading files. We did not
succeed in putting it in a tabbed pane at all. Now we are doing the
upload-facility outside the tabbed pane.
In your case, consider whether it is possible to close the outer form just
above the tabbed pane and open a new form just below the tabbed pane.
That would render three independent forms as a result. That should work
(but of course could raise other problems).
I worked around the problem, by implementing a tabbing system with CSS
and a few lines of javascript, works better than any server side tabbing
system anyway, and you definitely dont run into the validation problems
and form limitations of html that way.
Depending on my time, I will try to componentize it and send it in to
the myfaces people.

Loading...