You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sommeralex <al...@gmail.com> on 2012/11/27 09:46:03 UTC

tml if statements: unique id components

Hi!

I have in some of my .tml pages several IF statements, which should show
some - depending on the if clause - actionlinks. 

if A
actionlink 1
actionlink 2
if B
actionlink 1

now, tapestry throws an exception, because i was giving the actionlink 1 the
id 1 which then was occuring 2 times in my tml code. I could fix it with
giving it another id (1a, 1b) but had also then to add onActionFromId1 and
onActionFromId2 -> which BOTH are doing the same. 

Is there some better way to reuse the same actionlink on my page within IF
statements or is this more a HTML issue / which, at the end, says in generel
that no ID should be reused (ID / as a unique identifier)

thx



--
View this message in context: http://tapestry.1045711.n5.nabble.com/tml-if-statements-unique-id-components-tp5718312.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: tml if statements: unique id components

Posted by Howard Lewis Ship <hl...@gmail.com>.
This is the exact reason for the EventLink component.


On Tue, Nov 27, 2012 at 8:46 AM, sommeralex <al...@gmail.com>wrote:

> Hi!
>
> I have in some of my .tml pages several IF statements, which should show
> some - depending on the if clause - actionlinks.
>
> if A
> actionlink 1
> actionlink 2
> if B
> actionlink 1
>
> now, tapestry throws an exception, because i was giving the actionlink 1
> the
> id 1 which then was occuring 2 times in my tml code. I could fix it with
> giving it another id (1a, 1b) but had also then to add onActionFromId1 and
> onActionFromId2 -> which BOTH are doing the same.
>
> Is there some better way to reuse the same actionlink on my page within IF
> statements or is this more a HTML issue / which, at the end, says in
> generel
> that no ID should be reused (ID / as a unique identifier)
>
> thx
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/tml-if-statements-unique-id-components-tp5718312.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Re: tml if statements: unique id components

Posted by Bryan Lewis <jb...@gmail.com>.
Or try the EventLink.  Multiple EventLinks can share the same handler
method.


On Tue, Nov 27, 2012 at 4:38 AM, sommeralex <al...@gmail.com>wrote:

> perfect. thank you.
>
>
> 2012/11/27 Lance Java [via Tapestry] <
> ml-node+s1045711n5718315h7@n5.nabble.com>
>
> > You can also avoid the if component all together using this pattern:
> > http://tapestry.apache.org/switching-cases.html
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://tapestry.1045711.n5.nabble.com/tml-if-statements-unique-id-components-tp5718312p5718315.html
> >  To unsubscribe from tml if statements: unique id components, click here<
> http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5718312&code=YWxleGFuZGVyLnNvbW1lckBnbWFpbC5jb218NTcxODMxMnwxMDUzMzQxMzM4
> >
> > .
> > NAML<
> http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/tml-if-statements-unique-id-components-tp5718312p5718319.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>

Re: tml if statements: unique id components

Posted by sommeralex <al...@gmail.com>.
perfect. thank you.


2012/11/27 Lance Java [via Tapestry] <
ml-node+s1045711n5718315h7@n5.nabble.com>

> You can also avoid the if component all together using this pattern:
> http://tapestry.apache.org/switching-cases.html
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://tapestry.1045711.n5.nabble.com/tml-if-statements-unique-id-components-tp5718312p5718315.html
>  To unsubscribe from tml if statements: unique id components, click here<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5718312&code=YWxleGFuZGVyLnNvbW1lckBnbWFpbC5jb218NTcxODMxMnwxMDUzMzQxMzM4>
> .
> NAML<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://tapestry.1045711.n5.nabble.com/tml-if-statements-unique-id-components-tp5718312p5718319.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: tml if statements: unique id components

Posted by Lance Java <la...@googlemail.com>.
You can also avoid the if component all together using this pattern:
http://tapestry.apache.org/switching-cases.html



--
View this message in context: http://tapestry.1045711.n5.nabble.com/tml-if-statements-unique-id-components-tp5718312p5718315.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: tml if statements: unique id components

Posted by Lance Java <la...@googlemail.com>.
Declare your shared content in a <t:block id="foo">...</t:block>
Then use <t:delegate to="foo" /> when you want to include the "foo" block in
your logic.





--
View this message in context: http://tapestry.1045711.n5.nabble.com/tml-if-statements-unique-id-components-tp5718312p5718314.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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