The quick and dirty is this:

Given:
        The targetId String of the related component passed into this
component as a parameter:
        resources is an injected instance of ComponentResources like so
        @Inject
        private ComponentResources resources;

Code:
Component comp = resources.getPage().getComponentResources()
        .getEmbeddedComponent(targetId);
if (!(comp instanceof SearchResults)) {
        throw new IllegalArgumentException(
                "targetId is not an instance of SearchResults");
}
return (SearchResults) comp;

Hope that helps.


On 6/13/07, Martin Reurings <[EMAIL PROTECTED]> wrote:
Can you give me some small example code on how you were able to gain access
from one tag to the other? I am currently trying to create a matchfield
validator in which one text field must match the value of another and I am
pondering on how to access the second field.

I know the id of the second field (in theory), all I need to know is how to
obtain access to the other field (apart from cheating my way out by
accessing the httprequest I suppose).

Regards,

 Martin

On 6/13/07, Todd Orr <[EMAIL PROTECTED]> wrote:
>
> I have created a solution that requires the developer to add a
> targetId parameter to the SearchForm component that specifies the ID
> of the SearchResults component. This is sort of how Label works with
> an input component. It currently requires the literal: prefix on the
> String targetId passed to it.
>
> This was easy enough. I suppose this is the correct way.
>
> On 6/12/07, Todd Orr <[EMAIL PROTECTED]> wrote:
> > How would one create two components that function by one passing the
> > results of some form processing to another?
> >
> > My use case is this: I have a reusable SearchForm component. This
> > component is little more than a  form that takes the search parameter
> > and executes the search using the OnEvent annotated method. I have a
> > second component, SearchResults. This component is currently a simple
> > wrapper around a grid for proof of concept. I would like to keep these
> > separate so that the page using these components can easily alter the
> > locations of the components, page logic, etc. with as little concern
> > for the enclosed components as possible.
> >
> > I'd like to set the SearchResults' source parameter to that of the
> > results of the SearchForm's submit event processing. I have yet to
> > create anything that works. What is the T5 recommended approach for
> > this desired case?
> >
> > Thanks,
> > T
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
(   /'  _/_ __  _ _
|/|///)(/(/(//_(-/
        _/
Phone: +31 (0)297-283665
E-mail: [EMAIL PROTECTED]
Website: http://www.windgazer.nl

"It's a dangerous business going out your front door."
                                                 -- J. R. R. Tolkien


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

Reply via email to