MyFaces Core
  1. MyFaces Core
  2. MYFACES-3326

UIData does not preserve submitted values on immediate requests

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.3
    • Fix Version/s: None
    • Component/s: JSR-314
    • Labels:
      None

      Description

      I have a h:dataTable component with an h:inputText component per row bound to a list. Now I want to add a new row with a h:commandLink outside the table via ajax. This link is immediate to avoid validation on the input components.

      The problem is, that when I set the command link immediate, data the user entered into the input components vanishes (render and execute in f:ajax are set to the table). I did some investigations and saw that UIData.encodeBegin() resets the state (and submitted values!) before rendering. IMO, the submitted values must be preserved if phases 3 to 5 are skipped.

      I first thought that setting _isValidChilds to false in processDecodes if renderResponse() is called might work. But as the link is outside and after the table renderResponse() is not called yet at that point. I wonder what the correct way to handle this could be? Maybe remember if processValidators() was called on the table. If not, don't kill the state.

      Btw. the same applies for ui:repeat.

      1. MYFACES-3326-testapp.zip
        9 kB
        Michael Kurz
      2. MYFACES-3326-idea01.patch
        1 kB
        Michael Kurz

        Activity

        Michael Kurz made changes -
        Attachment MYFACES-3326-idea01.patch [ 12496698 ]
        Hide
        Michael Kurz added a comment -

        A first very basic idea: remember if validation was executed for UIData. If no, don't clear the state.

        Show
        Michael Kurz added a comment - A first very basic idea: remember if validation was executed for UIData. If no, don't clear the state.
        Hide
        Michael Kurz added a comment -

        I did some further investigations and the problem is the same in Mojarra. The spec doc for UIData.encodeBegin() says the following:

        "In addition to the default behavior, ensure that any saved per-row state for our child input components is discarded unless it is needed to rerender the current page with errors."

        I additionaly scanned the spec and found no mention of displaying the submitted value if it is still set in render response (which apparently is done).

        So what do you think: Is this a valid issue?

        Show
        Michael Kurz added a comment - I did some further investigations and the problem is the same in Mojarra. The spec doc for UIData.encodeBegin() says the following: "In addition to the default behavior, ensure that any saved per-row state for our child input components is discarded unless it is needed to rerender the current page with errors." I additionaly scanned the spec and found no mention of displaying the submitted value if it is still set in render response (which apparently is done). So what do you think: Is this a valid issue?
        Hide
        Michael Kurz added a comment -

        Would be interesting to know, why the data model is refreshed and the state is cleared before rendering.

        Show
        Michael Kurz added a comment - Would be interesting to know, why the data model is refreshed and the state is cleared before rendering.
        Michael Kurz made changes -
        Field Original Value New Value
        Attachment MYFACES-3326-testapp.zip [ 12496473 ]
        Hide
        Michael Kurz added a comment -

        Added test application to demonstrate problem.

        Show
        Michael Kurz added a comment - Added test application to demonstrate problem.
        Michael Kurz created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Michael Kurz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development