Re: How to reuse a form?

2012-11-22 Thread membersound
So am I doing it this way?

t:if test=isSelectDrowdownToBeShown
   t:delegate to=selectBlock /
/t:if


t:block t:id=selectBlock
   t:select .../
/t:block


Is this the proper way of using blocks for my need in Q2?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-reuse-a-form-tp5718166p5718187.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



Re: How to reuse a form?

2012-11-22 Thread Thiago H de Paula Figueiredo

On Thu, 22 Nov 2012 09:09:53 -0200, membersound memberso...@web.de wrote:


So am I doing it this way?

t:if test=isSelectDrowdownToBeShown
   t:delegate to=selectBlock /
/t:if


t:block t:id=selectBlock
   t:select .../
/t:block


Is this the proper way of using blocks for my need in Q2?


Nope if you want to add stuff to your form when using the component your  
created. You don't need blocks for just using the If component in the way  
you used above.


One example, not tested:

In the component class:

@Parameter(defaultPrefix = BindingConstants.LITERAL)
@Property
private Block additionalStuff;

In the component template:

t:form
...
t:delegate to=additionalStuff/
...
/t:form

Usage:

t:thecomponentyoucreatedwiththeforminside
p:additionalStuff
anything you want
/p:additionalStuff
/t:thecomponentyoucreatedwiththeforminside

--
Thiago H. de Paula Figueiredo

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



Re: How to reuse a form?

2012-11-22 Thread Lance Java
In addition to Thiago's suggestion, I often set a default for the block:

@Parameter(value=block:defaultAdditionalStuff, defaultPrefix =
BindingConstants.LITERAL)
@Property
private Block additionalStuff;

t:form
...
t:delegate to=additionalStuff/
...
/t:form 
t:block t:id=defaultAdditionalStuff
   Only show this when an additionalStuff parameter has not been supplied
/t:block



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-reuse-a-form-tp5718166p5718189.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



Re: How to reuse a form?

2012-11-21 Thread Chris Poulsen
Ad 1) Wrap it in a component
Ad 2) I'm not sure, but my guess would be that you can supply extra
stuff as a block

-- 
Chris

On Wed, Nov 21, 2012 at 10:37 PM, membersound memberso...@web.de wrote:
 Hi,

 I have a form that I want to reuse for another action of a page.
 Q1) How can I define a t:form and just reuse the exact definitions without
 having to copy/paste the whole form all the time?
 Q2) How can I place an additional field (I require a dropdown t:select) into
 that form? Without having to copy/paste the whole form code again (which
 would cause a lot of dublication)?

 It is similar to this:

 t:form
 div class=t-beaneditor
 t:beaneditor object=myObj 
 div class=t-beaneditor-row

  t:label for=checkbox
  t:checkbox t:id=checkbox t:mixings=frag1 /
 /div
 t:formfragment t:id=frag1 /
 /t:beaneditor


 Could someone help?`
 Thanks!





 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/How-to-reuse-a-form-tp5718166.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


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



Re: How to reuse a form?

2012-11-21 Thread Thiago H de Paula Figueiredo

On Wed, 21 Nov 2012 19:37:34 -0200, membersound memberso...@web.de wrote:


Hi,


Hi!


I have a form that I want to reuse for another action of a page.
Q1) How can I define a t:form and just reuse the exact definitions  
without having to copy/paste the whole form all the time?


Put it inside a component, use this component anywhere you want. :)

Q2) How can I place an additional field (I require a dropdown t:select)  
into that form? Without having to copy/paste the whole form code again  
(which

would cause a lot of dublication)?


Block parameters. Check  
http://tapestry.apache.org/component-templates.html for t:block and the  
parameter namespace.


--
Thiago H. de Paula Figueiredo

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