On Fri, 04 May 2012 08:43:27 -0300, Arno Haase <arno.ha...@haase-consulting.com> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi everyone,

this may be an obvious newbie question, but I have found no answer
that looks good to me. Anyway, here goes:

What is the best place to initialize a property with a default value
for a form?

A method handling the prepare event from Form:

onPrepare() { ... }

@OnEvent("prepare")
anyMethodName() { ... }

onPrepare() is called before data binding, but it is called again
after data binding. So simple initialization code in onPrepare() would
overwrite the form data with the default.

This isn't correct. It's called once per request. And Tapestry uses redirect-after-post, so the form submission and the form rendering are never in the same request (unless you're doing the submission though AJAX).

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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

Reply via email to