Handle specific bubbled up validate event

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Handle specific bubbled up validate event

nquirynen
Hi,

In a page I have a component that contains multiple forms. Now I want to
handle the bubbled up validate event from one of these forms in my page.
I know I can handle the validate event with
"onValidateFrom[ComponentName]()", but this handles all bubbled up
validate events from the component I think and is not specific enough. I
need something like "onValidateFrom[ComponentName]From[FormName]()". Is
there a way with naming convention to do this? Or do I need to do
something else?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Handle specific bubbled up validate event

Lance Java
The page sees the component as a black box and doesn't know about its
internal component structure. This encapsulation is by design. If you want
more specific events you'll need to trigger them from your component.
Reply | Threaded
Open this post in threaded view
|

Re: Handle specific bubbled up validate event

nquirynen
In reply to this post by nquirynen
On 28/04/15 09:40, Nathan Quirynen wrote:

> Hi,
>
> In a page I have a component that contains multiple forms. Now I want
> to handle the bubbled up validate event from one of these forms in my
> page.
> I know I can handle the validate event with
> "onValidateFrom[ComponentName]()", but this handles all bubbled up
> validate events from the component I think and is not specific enough.
> I need something like "onValidateFrom[ComponentName]From[FormName]()".
> Is there a way with naming convention to do this? Or do I need to do
> something else?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
I was too fast with asking. I just fixed it with following:

In the onValidateFrom[FormId] inside my component I added following:

componentResources.triggerEvent("validate[FormId]", null, null);

and then in my page I can use following event:

onValidate[FormId]From[ComponentId]()

I hope this is the correct way of fixing this?


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Handle specific bubbled up validate event

Thiago H de Paula Figueiredo
Yes, it is. :)

On Tue, 28 Apr 2015 04:48:47 -0300, Nathan Quirynen  
<[hidden email]> wrote:

> On 28/04/15 09:40, Nathan Quirynen wrote:
>> Hi,
>>
>> In a page I have a component that contains multiple forms. Now I want  
>> to handle the bubbled up validate event from one of these forms in my  
>> page.
>> I know I can handle the validate event with  
>> "onValidateFrom[ComponentName]()", but this handles all bubbled up  
>> validate events from the component I think and is not specific enough.  
>> I need something like "onValidateFrom[ComponentName]From[FormName]()".  
>> Is there a way with naming convention to do this? Or do I need to do  
>> something else?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
> I was too fast with asking. I just fixed it with following:
>
> In the onValidateFrom[FormId] inside my component I added following:
>
> componentResources.triggerEvent("validate[FormId]", null, null);
>
> and then in my page I can use following event:
>
> onValidate[FormId]From[ComponentId]()
>
> I hope this is the correct way of fixing this?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]