FAQ
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

Search Discussions

  • Werner Punz at May 27, 2005 at 2:45 pm

    Werner Punz wrote:
    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.
    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 at May 27, 2005 at 4:08 pm
    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

    2005/5/27, Werner Punz <werpu@gmx.at>:
    Werner Punz wrote:
    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.
    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 at May 27, 2005 at 4:26 pm
    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




    Philipp Ahlner wrote:
    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>
  • Philipp Ahlner at May 27, 2005 at 5:38 pm
    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.

    2005/5/27, Werner Punz <werpu@gmx.at>:
    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


    Philipp Ahlner wrote:
    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>
  • Werner Punz at May 27, 2005 at 6:18 pm
    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



    Philipp Ahlner wrote:
    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.

    2005/5/27, Werner Punz <werpu@gmx.at>:
  • Alexander 'Alfe' Fetke at May 29, 2005 at 9:36 pm
    Hi, Philipp ...
    On Fri, 27 May 2005, Philipp Ahlner wrote:

    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>
    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
    alexander.fetke@prismtech.com
    www.xtradyne.com | www.prismtech.com

    * XTRADYNE Security Infrastructure - a PRISMTECH Product Line *
  • Csík Norbert at May 27, 2005 at 7:11 pm
    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.
    On 5/27/05, Werner Punz wrote:
    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

    --
    Norbert Csík
  • Enrique Medina at May 27, 2005 at 7:16 pm
    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 ;-)
    On 5/27/05, Csík Norbert wrote:
    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.
    On 5/27/05, Werner Punz wrote:
    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

    --
    Norbert Csík
  • Werner Punz at May 28, 2005 at 9:20 am

    Enrique Medina wrote:
    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
    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 at May 28, 2005 at 10:31 am
    Yes, you have to ;-)
    On 5/28/05, Werner Punz wrote:
    Enrique Medina wrote:
    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
    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 at May 28, 2005 at 10:54 am
    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.



    Enrique Medina wrote:
    Yes, you have to ;-)

    On 5/28/05, Werner Punz wrote:
  • Werner Punz at May 28, 2005 at 9:07 am

    Csík Norbert wrote:
    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.
    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 at May 28, 2005 at 9:48 am

    Csík Norbert wrote:
    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 at May 28, 2005 at 3:48 pm

    2005/5/28, Werner Punz <werpu@gmx.at>:

    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 at May 29, 2005 at 9:36 pm
    Hi, Werner ...
    On Fri, 27 May 2005, Werner Punz wrote:

    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
    alexander.fetke@prismtech.com
    www.xtradyne.com | www.prismtech.com

    * XTRADYNE Security Infrastructure - a PRISMTECH Product Line *
  • Werner Punz at May 31, 2005 at 10:00 am

    Alexander 'Alfe' Fetke wrote:
    Hi, Werner ...

    On Fri, 27 May 2005, Werner Punz wrote:

    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmyfaces
postedMay 27, '05 at 2:25p
activeMay 31, '05 at 10:00a
posts17
users6
websitemyfaces.apache.org

People

Translate

site design / logo © 2019 Grokbase