You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Marc A. Donis" <ma...@runbox.com> on 2007/11/01 16:15:03 UTC

binding id to a property (not a liteal)

Hi again,

I am trying to get a select component to take an id from its component 
class, rather than having it staticly defined in the tml.
It seems, however, that no matter what I try, the id is always interpreted 
as a literal string.

e.g.:

<t:select t:id="prop:refFieldId" ... etc

which I would expect to get the id from an accessor named getRefFieldId() in 
the component class, but instead it generates the id as "prop:refFieldId".

Is id special in this way?  If so, is there some sort of workaround for 
this?

What I want is something like this:

<t:label t:for="selectField">${message:label1}</t:label>
<t:ReferenceDropDown t:selectId="literal:selectField" ... etc />

and then, ReferenceDropDown.tml:

<t:select t:id="prop:selectId"  ... etc />

in order to tie the label to the select which is inside my own 
ReferenceDropDown component.

Thoughts?

Thanks again,
Marc


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


Re: binding id to a property (not a liteal)

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,

Try <t:select t:id="tapestry-id" t:clientid="client-id" .../>.

You can then refer to the component through its "tapestry-id" and get 
its "client-id" through getClientId(). : )

-Filip

Marc A. Donis skrev:
> Thanks, but when I put:
> 
> <t:select t:id="${prop:selectId}" ... />
> 
> in the template, the generated html then looks like this:
> 
> <select id="${prop:selectId}" name="${prop:selectId}">
> 
> Again, I can't seem to prevent it from interpreting the id as a literal 
> string.
> 
> However, if i put:
> 
> <t:select t:idX="${prop:selectId}" ... />
> 
> in the template, the generated html then looks like this:
> 
> <select id="select" idX="id_01" name="select">
> 
> So... it really seems that id is special.  This is troublesome, since it 
> is impossible (as far as I can tell) to reference an element in a 
> component from outside of that component.
> 
> What to do??
> 
> 
> ----- Original Message ----- From: "Christoph Jaeger" 
> <ch...@derwald.at>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Thursday, November 01, 2007 19:05
> Subject: Re: binding id to a property (not a liteal)
> 
> 
>> Try <t:select t:id="${prop:refFieldId}" ...
>>
>> Christoph
>>
>> Marc A. Donis wrote:
>>> Hi again,
>>>
>>> I am trying to get a select component to take an id from its component
>>> class, rather than having it staticly defined in the tml.
>>> It seems, however, that no matter what I try, the id is always
>>> interpreted as a literal string.
>>>
>>> e.g.:
>>>
>>> <t:select t:id="prop:refFieldId" ... etc
>>>
>>> which I would expect to get the id from an accessor named
>>> getRefFieldId() in the component class, but instead it generates the id
>>> as "prop:refFieldId".
>>>
>>> Is id special in this way?  If so, is there some sort of workaround for
>>> this?
>>>
>>> What I want is something like this:
>>>
>>> <t:label t:for="selectField">${message:label1}</t:label>
>>> <t:ReferenceDropDown t:selectId="literal:selectField" ... etc />
>>>
>>> and then, ReferenceDropDown.tml:
>>>
>>> <t:select t:id="prop:selectId"  ... etc />
>>>
>>> in order to tie the label to the select which is inside my own
>>> ReferenceDropDown component.
>>>
>>> Thoughts?
>>>
>>> Thanks again,
>>> Marc
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

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


Re: binding id to a property (not a liteal)

Posted by "Marc A. Donis" <ma...@runbox.com>.
Thanks, but when I put:

 <t:select t:id="${prop:selectId}" ... />

 in the template, the generated html then looks like this:

<select id="${prop:selectId}" name="${prop:selectId}">

Again, I can't seem to prevent it from interpreting the id as a literal 
string.

However, if i put:

 <t:select t:idX="${prop:selectId}" ... />

 in the template, the generated html then looks like this:

<select id="select" idX="id_01" name="select">

So... it really seems that id is special.  This is troublesome, since it is 
impossible (as far as I can tell) to reference an element in a component 
from outside of that component.

What to do??


----- Original Message ----- 
From: "Christoph Jaeger" <ch...@derwald.at>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, November 01, 2007 19:05
Subject: Re: binding id to a property (not a liteal)


> Try <t:select t:id="${prop:refFieldId}" ...
>
> Christoph
>
> Marc A. Donis wrote:
>> Hi again,
>>
>> I am trying to get a select component to take an id from its component
>> class, rather than having it staticly defined in the tml.
>> It seems, however, that no matter what I try, the id is always
>> interpreted as a literal string.
>>
>> e.g.:
>>
>> <t:select t:id="prop:refFieldId" ... etc
>>
>> which I would expect to get the id from an accessor named
>> getRefFieldId() in the component class, but instead it generates the id
>> as "prop:refFieldId".
>>
>> Is id special in this way?  If so, is there some sort of workaround for
>> this?
>>
>> What I want is something like this:
>>
>> <t:label t:for="selectField">${message:label1}</t:label>
>> <t:ReferenceDropDown t:selectId="literal:selectField" ... etc />
>>
>> and then, ReferenceDropDown.tml:
>>
>> <t:select t:id="prop:selectId"  ... etc />
>>
>> in order to tie the label to the select which is inside my own
>> ReferenceDropDown component.
>>
>> Thoughts?
>>
>> Thanks again,
>> Marc
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
> 


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


Re: binding id to a property (not a liteal)

Posted by Christoph Jaeger <ch...@derwald.at>.
Try <t:select t:id="${prop:refFieldId}" ...

Christoph

Marc A. Donis wrote:
> Hi again,
> 
> I am trying to get a select component to take an id from its component
> class, rather than having it staticly defined in the tml.
> It seems, however, that no matter what I try, the id is always
> interpreted as a literal string.
> 
> e.g.:
> 
> <t:select t:id="prop:refFieldId" ... etc
> 
> which I would expect to get the id from an accessor named
> getRefFieldId() in the component class, but instead it generates the id
> as "prop:refFieldId".
> 
> Is id special in this way?  If so, is there some sort of workaround for
> this?
> 
> What I want is something like this:
> 
> <t:label t:for="selectField">${message:label1}</t:label>
> <t:ReferenceDropDown t:selectId="literal:selectField" ... etc />
> 
> and then, ReferenceDropDown.tml:
> 
> <t:select t:id="prop:selectId"  ... etc />
> 
> in order to tie the label to the select which is inside my own
> ReferenceDropDown component.
> 
> Thoughts?
> 
> Thanks again,
> Marc
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


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