Alex,

Id generation, as far as I know, does not come for free. If you want to receive an id generated by T5, you have to explicitly request it. You'll find this done in one of the parent classes of the field elements - possibly in AbstractField. I've implemented it the same way in several different components, one of which you can see here:

http://code.google.com/p/gc-tapestry-components/source/browse/trunk/gc-tapestry5-components/src/main/java/net/godcode/t5c/components/SlideShow.java

The key parts are:

       @Inject
       private ComponentResources resources;
@Environmental
       private PageRenderSupport renderSupport;
/** The client-side id. */
       private String clientId;
/* Render phase. */ @SetupRender
       void setupRender() {
clientId = renderSupport.allocateClientId(resources.getId());
       }

And then making sure you insert clientId into your component tag's id attribute. This could probably be isolated into a mixin, or you could probably just extend AbstractField. That would make sense as long as your component's behavior merits the semantics of a field (which it doesn't seem to).

Hope that helps.

chris


Alexander Lamb wrote:
Hello list,

It looks like custom components are not statefull.

Indeed, I have a loop which contains a graph I generate and a TextField (for testing purposes), and the generated code looks like this:

<div><img src="./statistics.dashboardview.enrollmentbenchmarkchart.monthserieslinechart:chart/460/280"></div></div></td></tr><tr><td><input id="textfield_8" name="textfield_8" type="text" value="ITALY"><img alt="[Error]" class="t-error-icon t-invisible" id="textfield_8:icon" src="assets/tapestry/field-error-marker.gif"><div> IT <div><img src="./statistics.dashboardview.enrollmentbenchmarkchart.monthserieslinechart:chart/460/280"></div></div></td></tr><tr><td><input id="textfield_9" name="textfield_9" type="text" value="NETHERLANDS"><img alt="[Error]" class="t-error-icon t-invisible" id="textfield_9:icon" src="assets/tapestry/field-error-marker.gif"><div> NL <div><img src="./statistics.dashboardview.enrollmentbenchmarkchart.monthserieslinechart:chart/460/280"></div></div></td></tr><tr><td><input id="textfield_10" name="textfield_10" type="text" value="NORWAY"><img alt="[Error]" class="t-error-icon t-invisible" id="textfield_10:icon" src="assets/tapestry/field-error-marker.gif"><div> NO As you can see, my TextField gets incremented but not my enrollmentbenchmarkchart !
Should I file a bug for this?
P.S. I tried to generate the ids but it didn't work.
Thanks,

Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to