You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alexander Muthmann <am...@dev-eth0.de> on 2010/01/28 14:03:44 UTC

Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Hi there,

I'm currently writing an application, which uses Tapestry 5.1. So far, I 
have no problems, but now I try to add some AJAX support.
I want to update a Zone on my page, if the user clicks an actionlink. 
For this, I use the following code:

<t:zone t:id="catsZone">
<t:actionlink t:id="myActionlink" zone="catsZone">text</t:actionlink>
</t:zone>

und in der Java Datei
@InjectComponent
private Zone _catsZone;
Object onActionFromMyActionlink(){
     return _catsZone.getBody();
}

The same problem occures, if I use a Beaneditform in a Zone:

<t:zone t:id="myZone">
<t:beaneditform object="myUser" zone="myZone"/>
</t:zone>

In both versions, I get the following error:

Return type org.apache.tapestry5.internal.structure.BlockImpl can not be 
handled. Configured return types are...

Could you please help me with this issue? I don't know, where my error is :(
A test with request.isXHR() always returns false...

Thanks a lot!

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


Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by SakshiAgarwal <sa...@gmail.com>.
Thanks a lot......now this works for me...I am so happy about it as I have
been struggling through it since many days...
my another doubt is - if i replace submit component with linksubmit; my
javascript method onclick is not getting invoked...
Whereas, if i use JSON or mixin my script is invoked only on page render.
i.e when I open my Photo page(and that time, counter value is not even set,
so no way to inform which form to hide) and it doesn't get called again on
submitting the sub form.

Any workaround for that ?

Regards
Sakshi


Jonathan Barker wrote:
> 
> You need to make sure that the form's zone parameter is set to the id and
> not just the t:id of the Zone.  I started generating my own xml id's from
> a
> root name and the actual database id of the object I was about to use.
> 
> I can't speak to mixing in the custom javascript, except that when the
> Ajax
> submit is working properly, the response should effectively clear the
> display:none that you just set before sending the request.  Your response
> need's to indicate that the style of the form should be hidden - or don't
> even return a form, return some text to indicate it's been dealt with.  If
> that is the case, then you won't need the custom javascript anyway.
> 
> You might also want to consider setting the context of the form.  I've
> bumped my head on problems with loop state and forms before, but it does
> depend what you are looping over.  Nested loops can be fun.
> 
> JB
> 
> 
> On Thu, Jun 24, 2010 at 12:52 AM, SakshiAgarwal
> <sa...@gmail.com>wrote:
> 
>>
>> Hi,
>>
>> I did check this example, but it helped me only to some extent.
>> The main problem in my case is:
>> the structure of my TML file is like this:
>> Loop
>>      Zone
>>             Form (defined photoZOne here)
>>                    Submit
>> the main problem is: counter value for first form does not function
>> properly...it gives very unpredictable results..for rest of the
>> subsequent
>> forms ( from the loop) works properly...
>>
>> Any suggestions/advice ?
>> http://old.nabble.com/file/p28978902/photos.tml photos.tml
>>
>> I hope I am clear in my problem stmt. Looking fwd for solution for my
>> problem.
>> regards
>> sakshi
>>
>> P.S. The reason I use zone here is: I have 'reported catergory' attached
>> to
>> each photo. and if I disapprove I need to submit it with the reason i.e.
>> 'reported category' that particular photo. So i can't submit the entire
>> form( as it contains multiple photos).
>> I also need to add java script in my code as I want to hide the photo as
>> soon as i take action on it. (i.e. approve/disapprove)
>> Looked at many examples but nothing works fine with everything in place,
>> i.e. zone,loop,form,javascript all together
>>
>>
>> Geoff Callender-2 wrote:
>> >
>> > Does this example help?
>> >
>> >
>> >
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxform
>> >
>> > On 23/06/2010, at 3:06 PM, SakshiAgarwal wrote:
>> >
>> >>
>> >> Hi,
>> >>
>> >> Thanks a lot for the reply. It works now.
>> >> I have been struggling hard to make zone work with Form Submit
>> component.
>> >> I read on http://www.infoq.com/articles/tapestry5-intro, how to make
>> AJAX
>> >> request.
>> >> So accordingly from my attached Photos.tml file, I should make
>> >> onSuccessFromDisapprovePhoto and from this method I should return Zone
>> >> body.
>> >>
>> >> But in my case, none of the methods are getting invoked - eg:
>> >> onSelectedFromDisapprovePhoto/onSuccessFromDisapprovePhoto
>> >> They work fine with ActionLink but not otherwise.
>> >>
>> >> http://old.nabble.com/file/p28967834/Photos.java Photos.java
>> >> http://old.nabble.com/file/p28967834/Photos.tml Photos.tml
>> >>
>> >> In my case, I have tried JSON, Mixin for javascript code. but none
>> works
>> >> with zone.
>> >> How to make it a AJAX request??
>> >> Please guide me.
>> >>
>> >> regards
>> >> sakshi
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28967834.html
>> >> Sent from the Tapestry - User 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
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28978902.html
>> Sent from the Tapestry - User 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
>>
>>
> 
> 
> -- 
> Jonathan Barker
> ITStrategic
> 
> 

-- 
View this message in context: http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28989193.html
Sent from the Tapestry - User 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: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by Jonathan Barker <jo...@gmail.com>.
You need to make sure that the form's zone parameter is set to the id and
not just the t:id of the Zone.  I started generating my own xml id's from a
root name and the actual database id of the object I was about to use.

I can't speak to mixing in the custom javascript, except that when the Ajax
submit is working properly, the response should effectively clear the
display:none that you just set before sending the request.  Your response
need's to indicate that the style of the form should be hidden - or don't
even return a form, return some text to indicate it's been dealt with.  If
that is the case, then you won't need the custom javascript anyway.

You might also want to consider setting the context of the form.  I've
bumped my head on problems with loop state and forms before, but it does
depend what you are looping over.  Nested loops can be fun.

JB


On Thu, Jun 24, 2010 at 12:52 AM, SakshiAgarwal <sa...@gmail.com>wrote:

>
> Hi,
>
> I did check this example, but it helped me only to some extent.
> The main problem in my case is:
> the structure of my TML file is like this:
> Loop
>      Zone
>             Form (defined photoZOne here)
>                    Submit
> the main problem is: counter value for first form does not function
> properly...it gives very unpredictable results..for rest of the subsequent
> forms ( from the loop) works properly...
>
> Any suggestions/advice ?
> http://old.nabble.com/file/p28978902/photos.tml photos.tml
>
> I hope I am clear in my problem stmt. Looking fwd for solution for my
> problem.
> regards
> sakshi
>
> P.S. The reason I use zone here is: I have 'reported catergory' attached to
> each photo. and if I disapprove I need to submit it with the reason i.e.
> 'reported category' that particular photo. So i can't submit the entire
> form( as it contains multiple photos).
> I also need to add java script in my code as I want to hide the photo as
> soon as i take action on it. (i.e. approve/disapprove)
> Looked at many examples but nothing works fine with everything in place,
> i.e. zone,loop,form,javascript all together
>
>
> Geoff Callender-2 wrote:
> >
> > Does this example help?
> >
> >
> >
> http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxform
> >
> > On 23/06/2010, at 3:06 PM, SakshiAgarwal wrote:
> >
> >>
> >> Hi,
> >>
> >> Thanks a lot for the reply. It works now.
> >> I have been struggling hard to make zone work with Form Submit
> component.
> >> I read on http://www.infoq.com/articles/tapestry5-intro, how to make
> AJAX
> >> request.
> >> So accordingly from my attached Photos.tml file, I should make
> >> onSuccessFromDisapprovePhoto and from this method I should return Zone
> >> body.
> >>
> >> But in my case, none of the methods are getting invoked - eg:
> >> onSelectedFromDisapprovePhoto/onSuccessFromDisapprovePhoto
> >> They work fine with ActionLink but not otherwise.
> >>
> >> http://old.nabble.com/file/p28967834/Photos.java Photos.java
> >> http://old.nabble.com/file/p28967834/Photos.tml Photos.tml
> >>
> >> In my case, I have tried JSON, Mixin for javascript code. but none works
> >> with zone.
> >> How to make it a AJAX request??
> >> Please guide me.
> >>
> >> regards
> >> sakshi
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28967834.html
> >> Sent from the Tapestry - User 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
> >>
> >
> >
> > ---------------------------------------------------------------------
> > 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://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28978902.html
> Sent from the Tapestry - User 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
>
>


-- 
Jonathan Barker
ITStrategic

Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by SakshiAgarwal <sa...@gmail.com>.
Hi,

I did check this example, but it helped me only to some extent.
The main problem in my case is:
the structure of my TML file is like this:
Loop
      Zone
             Form (defined photoZOne here)
                    Submit
the main problem is: counter value for first form does not function
properly...it gives very unpredictable results..for rest of the subsequent
forms ( from the loop) works properly...

Any suggestions/advice ?
http://old.nabble.com/file/p28978902/photos.tml photos.tml 

I hope I am clear in my problem stmt. Looking fwd for solution for my
problem.
regards
sakshi

P.S. The reason I use zone here is: I have 'reported catergory' attached to
each photo. and if I disapprove I need to submit it with the reason i.e.
'reported category' that particular photo. So i can't submit the entire
form( as it contains multiple photos).
I also need to add java script in my code as I want to hide the photo as
soon as i take action on it. (i.e. approve/disapprove)
Looked at many examples but nothing works fine with everything in place,
i.e. zone,loop,form,javascript all together


Geoff Callender-2 wrote:
> 
> Does this example help? 
> 
> 
> http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxform
> 
> On 23/06/2010, at 3:06 PM, SakshiAgarwal wrote:
> 
>> 
>> Hi,
>> 
>> Thanks a lot for the reply. It works now.
>> I have been struggling hard to make zone work with Form Submit component.
>> I read on http://www.infoq.com/articles/tapestry5-intro, how to make AJAX
>> request. 
>> So accordingly from my attached Photos.tml file, I should make
>> onSuccessFromDisapprovePhoto and from this method I should return Zone
>> body.
>> 
>> But in my case, none of the methods are getting invoked - eg:
>> onSelectedFromDisapprovePhoto/onSuccessFromDisapprovePhoto 
>> They work fine with ActionLink but not otherwise.
>> 
>> http://old.nabble.com/file/p28967834/Photos.java Photos.java 
>> http://old.nabble.com/file/p28967834/Photos.tml Photos.tml 
>> 
>> In my case, I have tried JSON, Mixin for javascript code. but none works
>> with zone.
>> How to make it a AJAX request??
>> Please guide me.
>> 
>> regards
>> sakshi
>> 
>> -- 
>> View this message in context:
>> http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28967834.html
>> Sent from the Tapestry - User 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
>> 
> 
> 
> ---------------------------------------------------------------------
> 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://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28978902.html
Sent from the Tapestry - User 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: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by Geoff Callender <ge...@gmail.com>.
Does this example help? 

	http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxform

On 23/06/2010, at 3:06 PM, SakshiAgarwal wrote:

> 
> Hi,
> 
> Thanks a lot for the reply. It works now.
> I have been struggling hard to make zone work with Form Submit component.
> I read on http://www.infoq.com/articles/tapestry5-intro, how to make AJAX
> request. 
> So accordingly from my attached Photos.tml file, I should make
> onSuccessFromDisapprovePhoto and from this method I should return Zone body.
> 
> But in my case, none of the methods are getting invoked - eg:
> onSelectedFromDisapprovePhoto/onSuccessFromDisapprovePhoto 
> They work fine with ActionLink but not otherwise.
> 
> http://old.nabble.com/file/p28967834/Photos.java Photos.java 
> http://old.nabble.com/file/p28967834/Photos.tml Photos.tml 
> 
> In my case, I have tried JSON, Mixin for javascript code. but none works
> with zone.
> How to make it a AJAX request??
> Please guide me.
> 
> regards
> sakshi
> 
> -- 
> View this message in context: http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28967834.html
> Sent from the Tapestry - User 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
> 


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


Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by SakshiAgarwal <sa...@gmail.com>.
Hi,

Thanks a lot for the reply. It works now.
I have been struggling hard to make zone work with Form Submit component.
I read on http://www.infoq.com/articles/tapestry5-intro, how to make AJAX
request. 
So accordingly from my attached Photos.tml file, I should make
onSuccessFromDisapprovePhoto and from this method I should return Zone body.

But in my case, none of the methods are getting invoked - eg:
onSelectedFromDisapprovePhoto/onSuccessFromDisapprovePhoto 
They work fine with ActionLink but not otherwise.

http://old.nabble.com/file/p28967834/Photos.java Photos.java 
http://old.nabble.com/file/p28967834/Photos.tml Photos.tml 

In my case, I have tried JSON, Mixin for javascript code. but none works
with zone.
How to make it a AJAX request??
Please guide me.

regards
sakshi

-- 
View this message in context: http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28967834.html
Sent from the Tapestry - User 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: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 22 Jun 2010 03:09:56 -0300, SakshiAgarwal <sa...@gmail.com>  
wrote:

> Hi

Hi!

> Did u get the solution to ur problem.
> I am facing the same problem
> "component event handler method returned the value Block[Body of
> Photos:photozone, at context:Photos.tml, line 28]. Return type
> org.apache.tapestry5.internal.structure.BlockImpl can not be handled"

This happens when you return a Block in a non-AJAX request. @Inject  
Request and use its isXHR() method to check if the current request is an  
AJAX one or not.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by SakshiAgarwal <sa...@gmail.com>.
Hi 

Did u get the solution to ur problem.
I am facing the same problem
"component event handler method returned the value Block[Body of
Photos:photozone, at context:Photos.tml, line 28]. Return type
org.apache.tapestry5.internal.structure.BlockImpl can not be handled"

regards
sakshi
-- 
View this message in context: http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28956471.html
Sent from the Tapestry - User 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: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by Alexander Muthmann <am...@dev-eth0.de>.
The only error is caused by prototype:
Error: "throw $continue" is deprecated, use "return" instead { 
message=""throw $continue" is deprecated, use "return" instead", more...}
Line: 4159
File: https://localhost/assets/scriptaculous/5.1.0.5/prototype.js

Nothing else

On 28.01.2010 14:45, Thiago H. de Paula Figueiredo wrote:
> On Thu, 28 Jan 2010 11:36:07 -0200, Alexander Muthmann 
> <am...@dev-eth0.de> wrote:
>
>> I don't use any custom javascript and other thinks like a 
>> autocomplete work, so I don't think, it's a problem with my 
>> configuration.
>> To return null is what I do
>> if(request.isXHR) {
>> return zone.getBody();
>> }
>> else return null;
>
> Use Firebug and/or Web Developer (Firefox addons) to check if anything 
> is going wrong in the Javascript side.
>

Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 28 Jan 2010 11:36:07 -0200, Alexander Muthmann  
<am...@dev-eth0.de> wrote:

> I don't use any custom javascript and other thinks like a autocomplete  
> work, so I don't think, it's a problem with my configuration.
> To return null is what I do
> if(request.isXHR) {
> return zone.getBody();
> }
> else return null;

Use Firebug and/or Web Developer (Firefox addons) to check if anything is  
going wrong in the Javascript side.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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


Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by Alexander Muthmann <am...@dev-eth0.de>.
Wow, that was fast, thank you very much...

I don't use any custom javascript and other thinks like a autocomplete 
work, so I don't think, it's a problem with my configuration.
To return null is what I do
if(request.isXHR) {
return zone.getBody();
}
else return null;

On 28.01.2010 14:13, Thiago H. de Paula Figueiredo wrote:
> Make sure Javascript is enabled and there are no Javascript errors in 
> your page.
>
> By the way, when Request.isXHR() returns false, you should return null 
> to refresh the page.
>

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


Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Make sure Javascript is enabled and there are no Javascript errors in your  
page.

By the way, when Request.isXHR() returns false, you should return null to  
refresh the page.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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