1. Tapestry
  2. TAPESTRY-1972

Client persistence bug - user typing lost


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 5.0.6
    • Fix Version/s: None
    • Component/s: tapestry-core
    • Labels:
    • Environment:
      Safari, OS X, JBoss 4.2.1


      The user loses the changes they typed into an "input" or "edit" page if an error is recorded by onSuccess() AND the page is dealing with a client persisted object. The page is redisplayed OK, with error, but with the previous values!!!

      The user's changes aren't lost if
      (a) I move the work that finds the error from onSuccess() into onValidate() - this fixes all TextField components but does not fix Select, DateField, checkbox, or expansions; or
      (b) I add a simple client-persisted field to the page - remarkably this fixes; or
      (c) I replace client persistence with session persistence.

      To illustrate the problem, it's just like the example from http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html, which contains these excerpts:

      private String _userName;

      private String _password;

      String onSuccess()
      if (!_authenticator.isValid(_userName, _password))

      { _form.recordError(_passwordField, "Invalid user name or password."); return null; }

      return "PostLogin";

      except that instead of a single field, _userName, I am persisting a whole object, _user:

      private User _user;

      and in the template we refer to its fields, eg:

      <input t:type="TextField" t:id="firstName" value="user.firstName" ...

      If the user types a value into firstName, but the onSuccess() method records an error, then the user loses what they typed.

      However, if I add another field to the page then everything works!

      private String _aField;

      <input t:type="TextField" t:id="aField" value="aField" ...

      Alternatively, it works if I do either of the other 2 things - use session persistence or move all logic into onValidate().

        Issue Links


          Geoff Callender created issue -
          Howard M. Lewis Ship made changes -
          Field Original Value New Value
          Assignee Howard M. Lewis Ship [ hlship ]
          Resolution Invalid [ 6 ]
          Status Open [ 1 ] Closed [ 6 ]
          Geoff Callender made changes -
          Link This issue is related to TAP5-812 [ TAP5-812 ]
          Mark Thomas made changes -
          Workflow jira [ 12419048 ] Default workflow, editable Closed status [ 12569279 ]
          Mark Thomas made changes -
          Workflow Default workflow, editable Closed status [ 12569279 ] jira [ 12590530 ]


            • Assignee:
              Howard M. Lewis Ship
              Geoff Callender
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: