You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "ashu.soman" <So...@atos.net> on 2011/07/21 09:31:43 UTC

Loop and javascript

Hi,

I need to use javascript in a loop which uses t:id of an element(a radio
button). The javascript in an onclick event on another element(an image).
But since tapestry is not allowing me to put t:id in t:id="${}" this
fashion, i'm facing problem. 

Basically what i want to do is check corresponding radio button when clicked
on an image. But since i need to use t:loop, i'm not able to access proper
id through javascript for that. 

Please suggest how can i do it or is there any better way to do it?

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Loop-and-javascript-tp4618424p4618424.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


RE: Loop and javascript

Posted by "ashu.soman" <So...@atos.net>.
Hi!

the same works for checkboxes. It takes t:clientId as id when generating
html. But in case of radio buttons with radiogroup, it takes auto generated
id unless you specify one in t:id.

Ashutosh

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Loop-and-javascript-tp4618424p4622407.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


RE: Loop and javascript

Posted by "ashu.soman" <So...@atos.net>.
The generated code anyway  won’t show t:id.. but if I give id instead of t:id, it trats it as css id and the generated html would have automatically generated id by tapestry instead of the id given by us in id=”${}” 

 

 

Warm Regards,

 

Ashutosh Soman           

     

 

From: Thiago H. de Paula Figueiredo [via Tapestry] [mailto:ml-node+4619581-11006814-233020@n5.nabble.com] 
Sent: Thursday, July 21, 2011 7:55 PM
To: Ashutosh, Soman
Subject: Re: Loop and javascript

 

On Thu, 21 Jul 2011 10:53:00 -0300, Ashutosh, Soman   
<[hidden email]> wrote: 

> Hi!! 

Hi! 

> As mentioned above, I tried using id="${}" instead of t:id, but the   
> function getElementbyId() returns element based on t:id and not id 

This isn't true. Check the generated HTML and the post it here. 

-- 
Thiago H. de Paula Figueiredo 
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,   
and instructor 
Owner, Ars Machina Tecnologia da Informação Ltda. 
http://www.arsmachina.com.br

--------------------------------------------------------------------- 
To unsubscribe, e-mail: [hidden email] 
For additional commands, e-mail: [hidden email] 




________________________________

If you reply to this email, your message will be added to the discussion below:

http://tapestry.1045711.n5.nabble.com/Loop-and-javascript-tp4618424p4619581.html 

To unsubscribe from Loop and javascript, click here <http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4618424&code=U29tYW4uQXNodXRvc2hAYXRvcy5uZXR8NDYxODQyNHwtOTMxODc4NjY3> . 



This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Loop-and-javascript-tp4618424p4621991.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: Loop and javascript

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 21 Jul 2011 10:53:00 -0300, Ashutosh, Soman  
<So...@atos.net> wrote:

> Hi!!

Hi!

> As mentioned above, I tried using id="${}" instead of t:id, but the  
> function getElementbyId() returns element based on t:id and not id

This isn't true. Check the generated HTML and the post it here.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


RE: Loop and javascript

Posted by "Ashutosh, Soman" <So...@atos.net>.
Hi!!

As mentioned above, I tried using id="${}" instead of t:id, but the function getElementbyId() returns element based on t:id and not id which I tried and experimented with for quite some time now. And sadly, t:id soesn't accept ${} types of values, it needs to be hardcoded. 


Warm Regards,

Ashutosh Soman           

ODC-AWL | Vikhroli, Mumbai | : soman.ashutosh@atosorigin.com |  :+91 22 6733 3729  | :(M): +91 9769058194
     


-----Original Message-----
From: Thiago H. de Paula Figueiredo [mailto:thiagohp@gmail.com] 
Sent: Thursday, July 21, 2011 7:14 PM
To: users@tapestry.apache.org; Ashutosh, Soman
Subject: Re: Loop and javascript

On Thu, 21 Jul 2011 04:31:43 -0300, ashu.soman <So...@atos.net>  
wrote:

> Hi,

Hi!

> I need to use javascript in a loop which uses t:id of an element(a radio
> button). The javascript in an onclick event on another element(an image).
> But since tapestry is not allowing me to put t:id in t:id="${}" this
> fashion, i'm facing problem.

t:id is the Tapestry component instance id in the template. Tapestry pages  
and components have strictly static structure and very dynamic behavior.

What you need to do is using id="${}", not t:id.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br



This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.


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


Re: Loop and javascript

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 21 Jul 2011 04:31:43 -0300, ashu.soman <So...@atos.net>  
wrote:

> Hi,

Hi!

> I need to use javascript in a loop which uses t:id of an element(a radio
> button). The javascript in an onclick event on another element(an image).
> But since tapestry is not allowing me to put t:id in t:id="${}" this
> fashion, i'm facing problem.

t:id is the Tapestry component instance id in the template. Tapestry pages  
and components have strictly static structure and very dynamic behavior.

What you need to do is using id="${}", not t:id.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Loop and javascript

Posted by "ashu.soman" <So...@atos.net>.
For Tapestry 5 of course.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Loop-and-javascript-tp4618424p4618425.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Loop and javascript

Posted by LLTYK <LL...@mailinator.com>.
Use a mixin. They allow you to get the autogenerated Tapestry ids and pass
those to javascript.

Or you can change your javascript to use event.target instead of the id.
That will let you know what image was clicked, and then you can traverse the
dom for the nearest radiobutton.

--
View this message in context: http://tapestry-users.832.n2.nabble.com/Loop-and-javascript-tp6606437p6606626.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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