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 [EMAIL PROTECTED] 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:[EMAIL PROTECTED]
> > 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="[EMAIL PROTECTED]" and i always add
> > name="form_name" and id="form_name" just incase
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to