Yep, second Geoff.  That is what I am doing - using onPrepareForRender().  

Say specialized form is EditPerson.tml

<form t:type="Form" t:id="person" >
  <t:errors />

  [various form elements]
   
</form>
</html>

In the corresponding EditPerson.java, this what I have:

 /**
   *  Enables reuse of Edit as Create
   */
  void onPrepareForRender()
  {
    if (this.person == null) 
    {
      this.person = new Person();  // Person with defaults - populates the
form
    }
    else
    {
       // nothing to do - form will pick up persisted person object 
    }
  }

I am posting because this probably most directly addresses your question -
initialize with default values(?)  Not sure if it is the most correct or
elegant or what the side effects are - good or bad.  One being that the
person object needs to be persisted in the Session (for submit to work). 
Whereas using the beaneditor & co, you just need to use activationContext
and the person is initialized by just the Id.   

Thoughts?

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Best-place-to-initialize-form-data-tp5685603p5688725.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to