Thanks for the solutions. both ways worked.

to get the unique id from server side, I can do:
Client:
<script language="javascript">
var _uniqId="${uniqId}";
<!-- //
$('text1'+_uniqId).value = "new value";
$('text2'+_uniqId).value = "new value 2";
// -->
</script>

Server:
@Component
private TextField text1;

public String getUniqId() {
        String clientId = text1.getClientId();
        String[] parts = clientId.split(":");
        return (parts.length>1 && parts[1].length()>0) ? ":"+parts[1] : "";
}




pjanuario wrote:
> 
> I have the same problem, and the easy way to solve it is to had new html
> atribute to element like:
> 
> <input t:type="textfield" t:id="text1" field="fieldName" />
> 
> after update:
> <input id="text1:120f2926924" name="text1" type="text" field="fieldName">
> 
> Then on the client side you can access to field using prototype api.
> $$('input[field="fieldName"]')
> 
> 
> 2009/4/29 Howard Lewis Ship <hls...@gmail.com>
> 
>> That's a unique id injected into the client id as part of a partial page
>> update.
>>
>> Use the TextField's getClientId() method, after it has rendered, to
>> determine what clientId was assigned to it.
>>
>> On Wed, Apr 29, 2009 at 9:08 AM, roubaozi <lagjazz.j...@gmail.com> wrote:
>> >
>> > Hello all,
>> >
>> > A tapestry component for example:
>> > <input t:type="textfield" t:id="text1" />
>> > after the component is rendered, it becomes something like:
>> > <input id="text1:120f2926924" name="text1" type="text">
>> >
>> > what is the number 120f2926924? how do I get this number from the
>> client
>> > side, for example if I need to set the value of this input field
>> through
>> > javascript, I would like to do something like:
>> > $('text1').value = "new value";
>> > but how do I know the id of this element after it is rendered?
>> >
>> > Thanks
>> > --
>> > View this message in context:
>> http://www.nabble.com/-t%3A5.0.18--tapestry-component-id-attribute-value-format-tp23296131p23296131.html
>> > Sent from the Tapestry - User mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> > For additional commands, e-mail: users-h...@tapestry.apache.org
>> >
>> >
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator of Apache Tapestry
>> Director of Open Source Technology at Formos
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
> 
> 
> -- 
> Cumprimentos...
> Pedro Januário
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-t%3A5.0.18--tapestry-component-id-attribute-value-format-tp23296131p23316538.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to