If the component is an instance of IFormComponent then you can get the id with "ognl:components.bip.clientId". If not then I think the only option is to set a unique id on the component yourself and then call "ognl:components.bip.id"... You can get some help adding uniqueness to an id by using IRequestCycle.getUniqueId("idPrefix")

-Aj

Jim Steinberger wrote:
Joshua, thanks for your response.


I tried:

<div jwcid="@For" ...>
  <span jwcid="[EMAIL PROTECTED]" value="ognl:components.bip.id"></span>
</div>

And:

<div jwcid="@For" ...>
  <span jwcid="[EMAIL PROTECTED]" value="ognl:components.bip.idPath"></span>
</div>

In both cases, I got:
bip
bip
bip


Let me know if I misunderstood your e-mail, but I was expecting
something like:
bip
bip$0
bip$1

Thanks again,
Jim

-----Original Message-----
From: Joshua Long [mailto:[EMAIL PROTECTED] Sent: Monday, May 01, 2006 1:24 PM
To: Tapestry users
Subject: Re: Dynamically-named components

On Wed, 2006-04-26 at 14:29 -0400, Jim Steinberger wrote:

During the lifetime of a loop, the component does resolve under its
given name, thus :
<div jwcid ="@For" source = "ognl: ..." value = "ognl: ..." >
<img src="#" jwcid ="[EMAIL PROTECTED]"/> <span script = "foo.script" jwcid ="@Script" imageReference = "ognl: components.customName" />
</div>

so on ech iteration of the for loop, your script does get a reference to
the currently rendering component instance. It then can get and store
the idpath or whatever you please from the component in some javascript
array. Or you could just pass the component reference to some other
rendering component, like you might a block to a renderblock. that also
works... hth,
Joshua

Hello,

I'm creating components inside a @For component.  How can I refer to
these components from JavaScript?  i.e. I have to leave them anonymous
since there are several of them being created.

I thought about using the Script component to do this - passing in the
component as a symbol so I could dynamically query its name -- but I
have the same problem - I can't pass in the component if I don't know
its name.

Thanks,

Jim



---------------------------------------------------------------------
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]


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

Reply via email to