Re: Access to WOComponents of a page
Re: Access to WOComponents of a page
- Subject: Re: Access to WOComponents of a page
- From: Chuck Hill via Webobjects-dev <email@hidden>
- Date: Wed, 24 Jul 2019 20:04:45 -0700
> On Jul 24, 2019, at 2:53 AM, André Rothe via Webobjects-dev
> <email@hidden> wrote:
>
> Hi,
>
> How I can access the WOComponent objects of a page?
You should not. Components know their parent, parents don’t know their
children (child components). Technically you can, but it is difficult and I
won’t show you how because is it just the wrong way to use WO.
What you want reflects a misunderstanding of WO. You are working against the
tool, not with it.
If you will provide mode details on what you want to accomplish (now how you
want to do it), I think we can show you the right way to use WO.
Start with:
- why do you want to call setResponse(“”)? That is intended to hold what the
user has input. The parent component should never have access to that value
- when (what conditions) do you want to set this to “”?
If you are trying to clear it after a failed validation attempt, perhaps there
is simply a bug here:
https://github.com/molequedeideias/wonder/blob/00e813f91664a1df1a84902e03175e4a34cf7d0f/Frameworks/Misc/ERCaptcha/Sources/er/captcha/ERCaptcha.java#L94
And after that should be:
_response = null;
Perhaps resetCaptcha() should do that too.
Keep in mind, I have never seen this code before today and have no idea if that
is the version you are using. :-) That was the first hit in Google.
Chuck
> I use different WOComponents in a "Main WO" and I try to access the classes
> behind the components from Main.java to call some public methods on them. In
> example I would like to call ERCaptcha.setResponse("") on the component which
> is named as "captcha" within my page.
>
> captcha : er.captcha.ERCaptcha {
> validated = ...
> resetText = ...
> }
>
> I have tried to subclass the components and override some methods there, but
> it won't work as expected.
>
> capcha : PSDCaptcha {
> validated = ...
> resetText = ...
> }
>
> public class PSDCaptcha extends ERCaptcha {
> ....
> }
>
> Is there a map of all defined components in "Main WO" which I can access from
> i.e. context()?
>
> Thank you
> André
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden