You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2007/10/08 03:51:21 UTC

[Tapestry Wiki] Update of "Tapestry5HowToUseForms" by CesarLesc

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for change notification.

The following page has been changed by CesarLesc:
http://wiki.apache.org/tapestry/Tapestry5HowToUseForms

The comment on the change is:
how to use context parameter

------------------------------------------------------------------------------
   *failure -> calls onFailure()
   *submit -> calls onSubmit()
  
+ 
+ ==== Context Information ====
+ 
+ Sometimes you need to store additional data in a form (like the primary key of an entity in a edit page)
+ in such cases use the context parameter of the form, and retrieve this parameter with the onPrepare event.
+ 
+ for example the template:
+ {{{
+   <t:form t:id="form" t:context:"id">
+    
+   ...
+ 
+   </t:form>
+ 
+ }}}
+ 
+ and the page object:
+ 
+ {{{
+   private long id;
+ 
+   long getId(){
+     return id;
+   }
+ 
+   void onPrepare(long id){
+      this.id = id;
+   }
+ 
+ }}}
  
  ==== Dealing with multiple forms ====
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org