Hey Chris,

t:id="my_div" seems to do what you want. I haven't looked closely at
un-namespaced id works in Tapestry, I've just always used the t:id
variety...

Josh

On Thu, Apr 10, 2008 at 5:36 AM, Chris Lewis <[EMAIL PROTECTED]> wrote:
> Dear list,
>
> I decided to throw together an app detailing how JS works with T5 (how
> to connect behavior from a component or mixin, the important inner
> workings, etc). I created a mixin that attaches behavior (mouse overs)
> to an HTML element (and doing this requires the DOM id of that element).
> For a simple demo I just wanted to attach it to a styled <div
> id="my_div">, so I had to use a <div t:type="any" id="my_div">. No
> problem. Now I need that DOM id in my java code (mixin) so I can pass it
> to the instantiation string of my JS object. Here's what I tried:
>
>    @Parameter(value = "prop:componentResources.id", defaultPrefix =
> TapestryConstants.LITERAL_BINDING_PREFIX)
>    private String clientId;
>
> This is the 'usual' way of getting the client side id of the component,
> at least when that component outputs it in the html element body. Since
> Any does not, it appears to interpret (or rather ignore) the id
> attribute and treat it as an informal. The problem with that is there is
> no way, at least that I know of, to get my hands on that value in java
> code. So what I'm having to do in my template code is explicitly declare
> the t:clientId parameter:
>
> <div t:type="any" t:mixins="hoverhighlight" id="my_box" t:clientId="my_box">
>
> This works, but it's annoying that T5 can't know what the client side id
> will be. Components that actually produce a T5-generated client side id
> generally implement ClientElement#getClientId and explicitly insert the
> html id attribute with that as a value. I realize that it wouldn't make
> sense for _every_ component to do this, but IMO there should be a way to
> get at this id in the situations where it's been provided. Perhaps I've
> missed something, but unless I've missed something there's no current
> way to do this and get the dom id in code:
>
> <div t:type="any" t:mixins="hoverhighlight" id="my_box">
>
> Thanks for any input you can offer.
>
> chris
>
> --
> http://thegodcode.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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

Reply via email to