You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Julien Martin <ba...@gmail.com> on 2011/07/17 23:03:36 UTC

Basic question about T5 and tests

Hello,

I am in reference to the following page:
http://tapestry.apache.org/unit-testing-pages-or-components.html

In the form testing section the code goes as follows:

 Element form = doc.getElementById("*form1*");

What is actually meant by "*form1*"? The *t:id* or the actual *client* *id*?

If it is the client id, then how do I assign a client id to a beaneditform?

Thanks in advance,

Julien.

Re: Basic question about T5 and tests

Posted by Taha Hafeez <ta...@gmail.com>.
Hi

In tapestry t:id is the unique id of a component within a container
component which can be used to refer to the component in the java
class. The components that needs to use client id(javascript id)
implements ClientElement interface which has a single method
getClientId() that returns the client id. The components that allow
you to set the client id usually have a parameter 'clientid' except
for zone in which case there is an id parameter. You can check the
component reference for Tapestry version < 5.3 and javadoc for
Tapestry version >= 5.3 to see if a component provides such a
parameter.

The t:id(component id) and client id(javascript id) can be the same if
there is only one component with a particular t:id on the page.

So to answer your questions


On Mon, Jul 18, 2011 at 2:33 AM, Julien Martin <ba...@gmail.com> wrote:
> Hello,
>
> I am in reference to the following page:
> http://tapestry.apache.org/unit-testing-pages-or-components.html
>
> In the form testing section the code goes as follows:
>
>  Element form = doc.getElementById("*form1*");
>
> What is actually meant by "*form1*"? The *t:id* or the actual *client* *id*?
>

It is the client id not the t:id which you can pass to the script
using javaScriptSupport.addScript or addInitializerCall methods

> If it is the client id, then how do I assign a client id to a beaneditform?
>

BeanEditForm implements ClientElement so you can use getClient() to
get the client id. You can pass this id to the script using
javaScriptSupport methods mentioned above.

> Thanks in advance,
>
> Julien.
>

For examples you can refer to http://tawus.wordpress.com/category/component/

regards
Taha

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