You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leon Derks <le...@cumquat.nl> on 2008/04/29 17:45:49 UTC

T5: Page + render parts based on previous action

Hello

I want to render different parts in my page, based on an action in my 
previous page.

For example I have an "edit" section and an "add" section.

Based on the button I clicked in the previous page (edit or add button) 
I want to render the page with the corresponding section.

What is the best way to do this?

Leon

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


Re: T5: Page + render parts based on previous action

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi Leon,

A combination of flash persistence and selected events should do the trick:

.tml:

   <t:form t:id="form">
     <t:if t:test="add"> (add stuff) </t:if>
     <t:if t:test="edit"> (edit stuff) </t:if>

     <t:submit t:id="add"/>
     <t:submit t:id="edit"/>
   </t:form>

.java:

   @Property
   @Persist("flash")
   private boolean add;

   @Property
   @Persist("flash")
   private boolean edit;

   void onSelectedFromAdd() {
     add = true;
   }

   void onSelectedFromEdit() {
     edit = true;
   }

That should do it.

-Filip

Leon Derks skrev:
> Hello
> 
> I want to render different parts in my page, based on an action in my 
> previous page.
> 
> For example I have an "edit" section and an "add" section.
> 
> Based on the button I clicked in the previous page (edit or add button) 
> I want to render the page with the corresponding section.
> 
> What is the best way to do this?
> 
> Leon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

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