You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Leangen <dl...@canada.com> on 2005/04/05 05:49:25 UTC

Component name prefixes (was Tapestry Form component name)

This leads me to a question that I've been a bit curious about...

Would somebody mind kindly explaining the mechanism of having a prefix, such
as the form_name@Form below?

Why is this legal? What does the prefix "form_name" mean? How can it be
reused? Why is this useful?

Or, alternatively, if there is already someplace where this is explained
(including in TIA), I'd love to get a reference.


Thanks!
Dave



> -----Original Message-----
> From: stephen smithstone [mailto:skullboxhouse@lchost.co.uk]
> Sent: 5 April 2005 05:32
> To: Tapestry users
> Subject: Re: Tapestry Form component name
>
>
> i can't remember exactly but in the jwcid add the name before the @Form
> so something like jwcid="form_name@Form" and i always add
> name="form_name" and id="form_name" just incase



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


Re: Component name prefixes (was Tapestry Form component name)

Posted by Ben Eng <be...@jetpen.com>.
A unique component name is used to identify each component instance on
the page.

For example, I might add a getter on my page class to return the path
to my input field component, so that some JavaScript code can populate
the field.

    public String getSiteField()
    {
        IForm searchForm = (IForm) getComponent( "searchForm" );
        IFormComponent siteField = (IFormComponent) getComponent( "inputSite" );
        String field = searchForm.getName() + "." + siteField.getName();
        return field;
    }

This is also useful, when you need to assemble multiple components
onto the page, and wire them up to work with eachother. For example, a
result set browser and a pager control would work together, so you'd
need a way to identify the browser, so that it can be passed to the
pager.

Those are reasons related to coding the application itself. There are
also other reasons that support clients of the application. For
example, I need to be able to explicitly identify the HTML forms on
the page, so that jWebUnit can control them during a test. I need to
be able to explicitly identify the input fields, submit buttons, and
links for the same reason.

Ben


On Tue, Apr 05, 2005 at 12:49:25PM +0900, David Leangen wrote:
> 
> This leads me to a question that I've been a bit curious about...
> 
> Would somebody mind kindly explaining the mechanism of having a prefix, such
> as the form_name@Form below?
> 
> Why is this legal? What does the prefix "form_name" mean? How can it be
> reused? Why is this useful?
> 
> Or, alternatively, if there is already someplace where this is explained
> (including in TIA), I'd love to get a reference.
> 
> 
> Thanks!
> Dave
> 
> 
> 
> > -----Original Message-----
> > From: stephen smithstone [mailto:skullboxhouse@lchost.co.uk]
> > Sent: 5 April 2005 05:32
> > To: Tapestry users
> > Subject: Re: Tapestry Form component name
> >
> >
> > i can't remember exactly but in the jwcid add the name before the @Form
> > so something like jwcid="form_name@Form" and i always add
> > name="form_name" and id="form_name" just incase
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org

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