You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by xfile80303 <le...@grokers.net> on 2009/08/17 23:23:40 UTC

[T5.1] MultiZoneUpdate can not be handled Error

Hi all,

I'm trying to update two zones using the MultiZoneUpdate return type from my
onSuccessFrom<Form> method, but Tapestry gives me an error saying the return
type is not understood (see stack below).

I've read, and re-read the info on MultiZoneUpdate  usage at
http://tapestry.apache.org/tapestry5.1/guide/ajax.html but no where does it
mention anything about configuration (or how to trigger the zone update from
a form (besides the normal form 'zone' attribute)).

Any tips on getting this to work in Tapestry 5.1.0.5?

Thanks,

Levi

---
My form event handler method:

	Object onSuccessFromMain()
	{
		if (_mainCategoryIterator != null)
		{
			setMainCategory(_mainCategoryIterator);
		}

		MultiZoneUpdate mzu = new MultiZoneUpdate("primarySelectZone",
primarySelectZone.getBody());
		mzu.add("directZone", directZone.getBody());

		return mzu;
	}

The Stack Trace:

ERROR [http-8080-2: RequestExceptionHandler]: Processing of request failed
with uncaught exception: A component event handler method returned the value
MultiZoneUpdate[{primarySelectZone=Block[Body of Search:primaryselectzone,
at classpath:com/java/dse/cwp/eos/pages/Search.tml, line 52]}]. Return type
org.apache.tapestry5.ajax.MultiZoneUpdate can not be handled.  Configured
return types are java.lang.Class, java.lang.String, java.net.URL,
org.apache.tapestry5.Link, org.apache.tapestry5.StreamResponse,
org.apache.tapestry5.runtime.Component.
org.apache.tapestry5.runtime.ComponentEventException: A component event
handler method returned the value
MultiZoneUpdate[{primarySelectZone=Block[Body of Search:primaryselectzone,
at classpath:com/java/dse/cwp/eos/pages/Search.tml, line 52]}]. Return type
org.apache.tapestry5.ajax.MultiZoneUpdate can not be handled.  Configured
return types are java.lang.Class, java.lang.String, java.net.URL,
org.apache.tapestry5.Link, org.apache.tapestry5.StreamResponse,
org.apache.tapestry5.runtime.Component. [at
classpath:com/java/dse/cwp/eos/pages/Search.tml, line 18]
        at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1098)
        at
org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:75)
        at
org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
        at
$ComponentEventRequestHandler_1232a2b90f1.handle($ComponentEventRequestHandler_1232a2b90f1.java)
        at
org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
        at
$ComponentEventRequestHandler_1232a2b90f1.handle($ComponentEventRequestHandler_1232a2b90f1.java)
        at
org.apache.tapestry5.services.TapestryModule$36.handle(TapestryModule.java:2164)
        at
$ComponentEventRequestHandler_1232a2b90f1.handle($ComponentEventRequestHandler_1232a2b90f1.java)
        at
$ComponentEventRequestHandler_1232a2b90d7.handle($ComponentEventRequestHandler_1232a2b90d7.java)
        at
org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
        at
$ComponentRequestHandler_1232a2b8fe7.handleComponentEvent($ComponentRequestHandler_1232a2b8fe7.java)
        at
org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46)
        at $Dispatcher_1232a2b8ff3.dispatch($Dispatcher_1232a2b8ff3.java)
        at $Dispatcher_1232a2b8fe4.dispatch($Dispatcher_1232a2b8fe4.java)
        at
org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:245)
        at
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
        at
$RequestHandler_1232a2b8fe5.service($RequestHandler_1232a2b8fe5.java)
        at
org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778)
        at
$RequestHandler_1232a2b8fe5.service($RequestHandler_1232a2b8fe5.java)
        at
org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767)
        at
$RequestHandler_1232a2b8fe5.service($RequestHandler_1232a2b8fe5.java)
        at
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
        at
$RequestHandler_1232a2b8fe5.service($RequestHandler_1232a2b8fe5.java)

-- 
View this message in context: http://n2.nabble.com/-T5.1--MultiZoneUpdate-can-not-be-handled-Error-tp3462182p3462182.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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


Re: [T5.1] MultiZoneUpdate can not be handled Error

Posted by xfile80303 <le...@grokers.net>.
Hi Thiago, all,

I appreciate your help here.

Unfortunately I've not managed to get any of your suggestions working...

It seems to all simplify to the problem of submitting the form in an AJAX
way.  So, the real question seems to be:

How does one cause a Tapestry form, with a zone attribute specified, to be
submitted via javascript such that it gets submitted in a way that Tapestry
recognizes it as an AJAX submission?

Cheers,

Levi


Thiago H. de Paula Figueiredo wrote:
> 
> Em Mon, 17 Aug 2009 20:19:26 -0300, xfile80303 <le...@grokers.net>
> escreveu:
> 
>> Hi Thiago,
> 
> Hi!
> 
>> Request.isXHR() returns 'false' as you expected...
> 
> Fist part of the problem solved: figuring out what went wrong . . . :)
> 
>> So I'm not sure how to proceed... I'm far better at Java than
>> Javascript, so please pardon my ignorance.
> 
> No problem. :)
> 
>> The ID of the radiobutton components are created as a result of the
>> loop iterator, so I'm not sure how I can use Even.observe (or where I
>> would place a script containing Event.observe calls) to initiate the
>> form submission...
> 
> You must place the Event.observe calls after your radio buttons. The  
> Event.observe first parameter is the observed element (tag) id, so you  
> need to generate this code dynamically.  
> http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained tells you  
> how to do it.
> 
> Anyway, I guess your problem is that you're submitting the form directly  
> and Tapestry.js not being notified of that. Try programatically clicking  
> in a submit button.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/-T5.1--MultiZoneUpdate-can-not-be-handled-Error-tp3462182p3467137.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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


Re: [T5.1] MultiZoneUpdate can not be handled Error

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 17 Aug 2009 20:19:26 -0300, xfile80303 <le...@grokers.net> escreveu:

> Hi Thiago,

Hi!

> Request.isXHR() returns 'false' as you expected...

Fist part of the problem solved: figuring out what went wrong . . . :)

> So I'm not sure how to proceed... I'm far better at Java than
> Javascript, so please pardon my ignorance.

No problem. :)

> The ID of the radiobutton components are created as a result of the
> loop iterator, so I'm not sure how I can use Even.observe (or where I
> would place a script containing Event.observe calls) to initiate the
> form submission...

You must place the Event.observe calls after your radio buttons. The  
Event.observe first parameter is the observed element (tag) id, so you  
need to generate this code dynamically.  
http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained tells you  
how to do it.

Anyway, I guess your problem is that you're submitting the form directly  
and Tapestry.js not being notified of that. Try programatically clicking  
in a submit button.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: [T5.1] MultiZoneUpdate can not be handled Error

Posted by xfile80303 <le...@grokers.net>.
Hi Thiago,

Request.isXHR() returns 'false' as you expected...

So I'm not sure how to proceed... I'm far better at Java than  
Javascript, so please pardon my ignorance.

The ID of the radiobutton components are created as a result of the  
loop iterator, so I'm not sure how I can use Even.observe (or where I  
would place a script containing Event.observe calls) to initiate the  
form submission...

For reference, I'm looking here:

http://www.prototypejs.org/api/event/observe

Your suggestions are greatly appreciated.

Thanks,

Levi


On Aug 17, 2009, at 16:40, Thiago H. de Paula Figueiredo (via Nabble)  
wrote:
> Em Mon, 17 Aug 2009 19:25:54 -0300, xfile80303 <le...@grokers.net>  
> escreveu:
>
>> Can you suggest how I should activate the ajax refresh when the user
>> clicks on one of the radio buttons?
>
> Please check first Request.isXHR() in your event handler to see  
> whether
> this really is the source of the problem.
> Another hint: instead of relying in onclick, use Prototype's
> Event.observe() method.
>
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
> ______________________________________
> View message @ http://n2.nabble.com/-T5.1--MultiZoneUpdate-can-not-be-handled-Error-tp3462182p3462618.html
>
> To unsubscribe from Re: [T5.1] MultiZoneUpdate can not be handled  
> Error, click  (link removed) 


-- 
View this message in context: http://n2.nabble.com/-T5.1--MultiZoneUpdate-can-not-be-handled-Error-tp3462182p3462793.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

Re: [T5.1] MultiZoneUpdate can not be handled Error

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 17 Aug 2009 19:25:54 -0300, xfile80303 <le...@grokers.net> escreveu:

> Can you suggest how I should activate the ajax refresh when the user  
> clicks on one of the radio buttons?

Please check first Request.isXHR() in your event handler to see whether  
this really is the source of the problem.
Another hint: instead of relying in onclick, use Prototype's  
Event.observe() method.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: [T5.1] MultiZoneUpdate can not be handled Error

Posted by xfile80303 <le...@grokers.net>.
Can you suggest how I should activate the ajax refresh when the user clicks
on one of the radio buttons?

Levi


Thiago H. de Paula Figueiredo wrote:
> 
> Em Mon, 17 Aug 2009 19:10:01 -0300, xfile80303 <le...@grokers.net>
> escreveu:
> 
>> Hi Thiago!
> 
> Hi!
> 
>> Yes, I'm sorry I should have mentioned this...
>> My form uses the zone attribute to indicate it should refresh a zone via
>> AJAX (or at lease that's my understanding of the attribute from the
>> documentation):
> 
> You still need to check Request.ixXHR(). Maybe the  
> onclick="this.form.submit()" are the source of your problem.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/-T5.1--MultiZoneUpdate-can-not-be-handled-Error-tp3462182p3462533.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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


Re: [T5.1] MultiZoneUpdate can not be handled Error

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 17 Aug 2009 19:10:01 -0300, xfile80303 <le...@grokers.net> escreveu:

> Hi Thiago!

Hi!

> Yes, I'm sorry I should have mentioned this...
> My form uses the zone attribute to indicate it should refresh a zone via
> AJAX (or at lease that's my understanding of the attribute from the
> documentation):

You still need to check Request.ixXHR(). Maybe the  
onclick="this.form.submit()" are the source of your problem.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: [T5.1] MultiZoneUpdate can not be handled Error

Posted by xfile80303 <le...@grokers.net>.
Hi Thaigo!

Yes, I'm sorry I should have mentioned this...

My form uses the zone attribute to indicate it should refresh a zone via
AJAX (or at lease that's my understanding of the attribute from the
documentation):


<form t:id="main" t:zone="primarySelectZone">
  <t:radiogroup t:id="mainCategoryGroup">
    <t:loop source="mainCategories" value="mainCategoryIterator"
        encoder="mainCategoryEncoder" index="radioIndex">
      <t:radio id="radio_${radioIndex}" value="mainCategoryIterator"
        onclick="this.form.submit();"/>
      <label for="radio_${radioIndex}">${mainCategoryIterator.name}</label>
    </t:loop>
  </t:radiogroup>
</form>


Thanks,

Levi

Thiago H. de Paula Figueiredo wrote:
> 
> Em Mon, 17 Aug 2009 18:23:40 -0300, xfile80303 <le...@grokers.net>
> escreveu:
> 
>> Hi all,
> 
> Hi!
> 
>> I'm trying to update two zones using the MultiZoneUpdate return type  
>> from my onSuccessFrom<Form> method, but Tapestry gives me an error  
>> saying the return type is not understood (see stack below).
> 
> You can only return MultiZoneUpdate (or Block or a component) when  
> handling an AJAX request. Use Request.isXHR() to check if the current  
> request is made through AJAX or not.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/-T5.1--MultiZoneUpdate-can-not-be-handled-Error-tp3462182p3462442.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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


Re: [T5.1] MultiZoneUpdate can not be handled Error

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 17 Aug 2009 18:23:40 -0300, xfile80303 <le...@grokers.net> escreveu:

> Hi all,

Hi!

> I'm trying to update two zones using the MultiZoneUpdate return type  
> from my onSuccessFrom<Form> method, but Tapestry gives me an error  
> saying the return type is not understood (see stack below).

You can only return MultiZoneUpdate (or Block or a component) when  
handling an AJAX request. Use Request.isXHR() to check if the current  
request is made through AJAX or not.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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