You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Kanze <pe...@gmail.com> on 2009/03/13 20:59:36 UTC

T5: How to set generated component id

Hello,

I want to add some blocks with a generated id. like this:

<t:loop source="thumbnailPictures" value="thumbnail" index="thumbIndex">
      <t:block id="image${thumbIndex}">
          <img t:type="filesystemImage"product="product"
position="thumbIndex" type="bigPictureType" />
      </t:block>
</t:loop>

But I get the following error message:
Block id 'image${thumbIndex}' is not valid; block ids must be valid Java
identifiers: start with a letter, and consist of letters, numbers and
underscores.

How can I give my block an id based on the current thumbIndex?

Any examples?

Thanks!
Peter

Re: T5: How to set generated component id

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 13 Mar 2009 16:59:36 -0300, Peter Kanze <pe...@gmail.com>  
escreveu:

> Hello,

Hi!

> I want to add some blocks with a generated id. like this:

Why exactly do you want blocks? Your example doesn't give any hints.  
Couldn't you just use <div>s instead?

> How can I give my block an id based on the current thumbIndex?

AFAIK, you just can't.
Blocks (<t:block) are made to declare a piece of template that isn't  
generated at first: it is always used with the Delegate component or to  
replace a Zone content with AJAX. Given that, it doesn't make much sense  
to put them in a loop.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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