You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by petros <pe...@cypoz.com> on 2008/03/28 06:40:50 UTC

Form with a Zone -> ComponentEventException

When the userSearchForm of the code below is submitted I am getting the
following exception

A component event handler method returned the value
org.apache.tapestry.internal.structure.BlockImpl@0ada6. Return type
org.apache.internal.structure.BlockImpl can not be handled. Configured
return types are java.lang.Class, java.lang.String, java.net.URL,
org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
org.apache.tapestry.runtime.Component. 

I am trying to update the search results table when the form is submited as
an Ajax call. Any ideas ?

UserPicker.java
@Inject
private Block searchResultsBlock;

Object onSuccessFromUserSearchForm()
{
   foundUsers = userManager.findUsers(...);
   return searchResultsBlock;
}

UserPicker.tml
...
<html>
   <body>
       <form t:id="userSearchForm" zone="searchResultsZone">
           ...
           <input t:type="Submit" value="Find Users"/>
       </form>

       <div t:type="Zone" t:id="searchResultZone"/>

       <div t:type="Block" t:id="searchResultsBlock">
           <table t:type="Grid" source="foundUsers"/>
       </div>
   </body>
<html>
-- 
View this message in context: http://www.nabble.com/Form-with-a-Zone--%3E-ComponentEventException-tp16346150p16346150.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: Form with a Zone -> ComponentEventException

Posted by Petros Petrou <pe...@cypoz.com>.
Oh well, your reply gives me something to look into anyway. I'll try to solve
the issue with the ModalBox guys and post the solution here.

Thanks,
Petros


Howard Lewis Ship wrote:
> 
> The question is: does this Modalbox send a request via XmlHttpRequest?
>  And does it use Tapestry's handling of the JSON response?
> 
> The error you are getting appears to be because it's not recognized as
> an XHR request, i.e., not an Ajax request and is being treated as a
> traditional request, for which a Block is not an appropriate
> navigation result from a event handler method.
> 
> I'm not familiar with Modalbox so I can't say any more.
> 
> On Sat, Mar 29, 2008 at 9:55 PM, petros <pe...@cypoz.com> wrote:
>>
>>  I found what is causing the error. Is the way I am displaying the the
>>  UserPicker page. I am trying to display it by using the Modalbox
>>  (http://www.wildbit.com/labs/modalbox/)
>>
>>  However, this works fine as an Ajax call by returning a Block when the
>>  UserPicker form is submitted
>>  <aa t:type="PageLink" page="User/PickerPage">  Assign Supervisor </aa>
>>
>>  BUT THIS FAILS
>>  <aa t:type="PageLink" page="User/PickerPage"
>>  onclick="Modalbox.show(this.href, {title: 'find user', width: 800
>> ,height:
>>  500}); return false;">
>>   Assign Supervisor
>>  </aa>
>>
>>
>>  Throws the exception that A component event handler method returned the
>>
>> value org.apache.tapestry.internal.structure.BlockImpl@0ada6. Return type
>>  org.apache.internal.structure.BlockImpl can not be handled. Configured
>>  return types are java.lang.Class, java.lang.String, java.net.URL,
>>  org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
>>  org.apache.tapestry.runtime.Component.
>>
>>  Why the use of modal box appears to interfear with the way tapestry
>> works
>>  internally ?
>>
>>  Petros
>>
>>
>>
>>
>>
>>  petros wrote:
>>  >
>>  > Sorry about the second post but this problem is killing me :)
>>  > I tried this example that works fine online and I am getting the same
>>  > exception as my previous post
>>  > http://lombok.demon.co.uk/tapestry5Demo/test/core/zonedemoone
>>  >
>>  > In the example a Block is returned from an onAction or onSuccess
>> methods
>>  > but in my case I am getting the exception that I am not allowed to
>> return
>>  > a Block object.
>>  >
>>  > Is there any configuration I need to do ? I am using 5.0.11
>>  >
>>  > Thanks,
>>  > Petros
>>  >
>>  >
>>  >
>>  > petros wrote:
>>  >>
>>  >> When the userSearchForm of the code below is submitted I am getting
>> the
>>  >> following exception
>>  >>
>>  >> A component event handler method returned the value
>>  >> org.apache.tapestry.internal.structure.BlockImpl@0ada6. Return type
>>  >> org.apache.internal.structure.BlockImpl can not be handled.
>> Configured
>>  >> return types are java.lang.Class, java.lang.String, java.net.URL,
>>  >> org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
>>  >> org.apache.tapestry.runtime.Component.
>>  >>
>>  >> I am trying to update the search results table when the form is
>> submited
>>  >> as an Ajax call. Any ideas ?
>>  >>
>>  >> UserPicker.java
>>  >> @Inject
>>  >> private Block searchResultsBlock;
>>  >>
>>  >> Object onSuccessFromUserSearchForm()
>>  >> {
>>  >>    foundUsers = userManager.findUsers(...);
>>  >>    return searchResultsBlock;
>>  >> }
>>  >>
>>  >> UserPicker.tml
>>  >> ...
>>  >> <html>
>>  >>    <body>
>>  >>        <form t:id="userSearchForm" zone="searchResultsZone">
>>  >>            ...
>>  >>            <input t:type="Submit" value="Find Users"/>
>>  >>        </form>
>>  >>
>>  >>        <div t:type="Zone" t:id="searchResultZone"/>
>>  >>
>>  >>        <div t:type="Block" t:id="searchResultsBlock">
>>  >>            <table t:type="Grid" source="foundUsers"/>
>>  >>        </div>
>>  >>    </body>
>>  >> <html>
>>  >>
>>  >
>>  >
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/Form-with-a-Zone--%3E-ComponentEventException-tp16346150p16378608.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
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> 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://www.nabble.com/Form-with-a-Zone--%3E-ComponentEventException-tp16346150p16432241.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: Form with a Zone -> ComponentEventException

Posted by Howard Lewis Ship <hl...@gmail.com>.
The question is: does this Modalbox send a request via XmlHttpRequest?
 And does it use Tapestry's handling of the JSON response?

The error you are getting appears to be because it's not recognized as
an XHR request, i.e., not an Ajax request and is being treated as a
traditional request, for which a Block is not an appropriate
navigation result from a event handler method.

I'm not familiar with Modalbox so I can't say any more.

On Sat, Mar 29, 2008 at 9:55 PM, petros <pe...@cypoz.com> wrote:
>
>  I found what is causing the error. Is the way I am displaying the the
>  UserPicker page. I am trying to display it by using the Modalbox
>  (http://www.wildbit.com/labs/modalbox/)
>
>  However, this works fine as an Ajax call by returning a Block when the
>  UserPicker form is submitted
>  <aa t:type="PageLink" page="User/PickerPage">  Assign Supervisor </aa>
>
>  BUT THIS FAILS
>  <aa t:type="PageLink" page="User/PickerPage"
>  onclick="Modalbox.show(this.href, {title: 'find user', width: 800 ,height:
>  500}); return false;">
>   Assign Supervisor
>  </aa>
>
>
>  Throws the exception that A component event handler method returned the
>
> value org.apache.tapestry.internal.structure.BlockImpl@0ada6. Return type
>  org.apache.internal.structure.BlockImpl can not be handled. Configured
>  return types are java.lang.Class, java.lang.String, java.net.URL,
>  org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
>  org.apache.tapestry.runtime.Component.
>
>  Why the use of modal box appears to interfear with the way tapestry works
>  internally ?
>
>  Petros
>
>
>
>
>
>  petros wrote:
>  >
>  > Sorry about the second post but this problem is killing me :)
>  > I tried this example that works fine online and I am getting the same
>  > exception as my previous post
>  > http://lombok.demon.co.uk/tapestry5Demo/test/core/zonedemoone
>  >
>  > In the example a Block is returned from an onAction or onSuccess methods
>  > but in my case I am getting the exception that I am not allowed to return
>  > a Block object.
>  >
>  > Is there any configuration I need to do ? I am using 5.0.11
>  >
>  > Thanks,
>  > Petros
>  >
>  >
>  >
>  > petros wrote:
>  >>
>  >> When the userSearchForm of the code below is submitted I am getting the
>  >> following exception
>  >>
>  >> A component event handler method returned the value
>  >> org.apache.tapestry.internal.structure.BlockImpl@0ada6. Return type
>  >> org.apache.internal.structure.BlockImpl can not be handled. Configured
>  >> return types are java.lang.Class, java.lang.String, java.net.URL,
>  >> org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
>  >> org.apache.tapestry.runtime.Component.
>  >>
>  >> I am trying to update the search results table when the form is submited
>  >> as an Ajax call. Any ideas ?
>  >>
>  >> UserPicker.java
>  >> @Inject
>  >> private Block searchResultsBlock;
>  >>
>  >> Object onSuccessFromUserSearchForm()
>  >> {
>  >>    foundUsers = userManager.findUsers(...);
>  >>    return searchResultsBlock;
>  >> }
>  >>
>  >> UserPicker.tml
>  >> ...
>  >> <html>
>  >>    <body>
>  >>        <form t:id="userSearchForm" zone="searchResultsZone">
>  >>            ...
>  >>            <input t:type="Submit" value="Find Users"/>
>  >>        </form>
>  >>
>  >>        <div t:type="Zone" t:id="searchResultZone"/>
>  >>
>  >>        <div t:type="Block" t:id="searchResultsBlock">
>  >>            <table t:type="Grid" source="foundUsers"/>
>  >>        </div>
>  >>    </body>
>  >> <html>
>  >>
>  >
>  >
>
>  --
>  View this message in context: http://www.nabble.com/Form-with-a-Zone--%3E-ComponentEventException-tp16346150p16378608.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
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: Form with a Zone -> ComponentEventException

Posted by petros <pe...@cypoz.com>.
I found what is causing the error. Is the way I am displaying the the
UserPicker page. I am trying to display it by using the Modalbox
(http://www.wildbit.com/labs/modalbox/)

However, this works fine as an Ajax call by returning a Block when the
UserPicker form is submitted
<aa t:type="PageLink" page="User/PickerPage">  Assign Supervisor </aa>

BUT THIS FAILS
<aa t:type="PageLink" page="User/PickerPage" 
onclick="Modalbox.show(this.href, {title: 'find user', width: 800 ,height:
500}); return false;"> 
  Assign Supervisor
</aa>


Throws the exception that A component event handler method returned the
value org.apache.tapestry.internal.structure.BlockImpl@0ada6. Return type
org.apache.internal.structure.BlockImpl can not be handled. Configured
return types are java.lang.Class, java.lang.String, java.net.URL,
org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
org.apache.tapestry.runtime.Component. 

Why the use of modal box appears to interfear with the way tapestry works
internally ?

Petros



petros wrote:
> 
> Sorry about the second post but this problem is killing me :)
> I tried this example that works fine online and I am getting the same
> exception as my previous post
> http://lombok.demon.co.uk/tapestry5Demo/test/core/zonedemoone
> 
> In the example a Block is returned from an onAction or onSuccess methods
> but in my case I am getting the exception that I am not allowed to return
> a Block object. 
> 
> Is there any configuration I need to do ? I am using 5.0.11
> 
> Thanks, 
> Petros
> 
> 
> 
> petros wrote:
>> 
>> When the userSearchForm of the code below is submitted I am getting the
>> following exception
>> 
>> A component event handler method returned the value
>> org.apache.tapestry.internal.structure.BlockImpl@0ada6. Return type
>> org.apache.internal.structure.BlockImpl can not be handled. Configured
>> return types are java.lang.Class, java.lang.String, java.net.URL,
>> org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
>> org.apache.tapestry.runtime.Component. 
>> 
>> I am trying to update the search results table when the form is submited
>> as an Ajax call. Any ideas ?
>> 
>> UserPicker.java
>> @Inject
>> private Block searchResultsBlock;
>> 
>> Object onSuccessFromUserSearchForm()
>> {
>>    foundUsers = userManager.findUsers(...);
>>    return searchResultsBlock;
>> }
>> 
>> UserPicker.tml
>> ...
>> <html>
>>    <body>
>>        <form t:id="userSearchForm" zone="searchResultsZone">
>>            ...
>>            <input t:type="Submit" value="Find Users"/>
>>        </form>
>> 
>>        <div t:type="Zone" t:id="searchResultZone"/>
>> 
>>        <div t:type="Block" t:id="searchResultsBlock">
>>            <table t:type="Grid" source="foundUsers"/>
>>        </div>
>>    </body>
>> <html>
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Form-with-a-Zone--%3E-ComponentEventException-tp16346150p16378608.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: Form with a Zone -> ComponentEventException

Posted by petros <pe...@cypoz.com>.
Sorry about the second post but this problem is killing me :)
I tried this example that works fine online and I am getting the same
exception as my previous post
http://lombok.demon.co.uk/tapestry5Demo/test/core/zonedemoone

In the example a Block is returned from an onAction or onSuccess methods but
in my case I am getting the exception that I am not allowed to return a
Block object. 

Is there any configuration I need to do ? I am using 5.0.11

Thanks, 
Petros



petros wrote:
> 
> When the userSearchForm of the code below is submitted I am getting the
> following exception
> 
> A component event handler method returned the value
> org.apache.tapestry.internal.structure.BlockImpl@0ada6. Return type
> org.apache.internal.structure.BlockImpl can not be handled. Configured
> return types are java.lang.Class, java.lang.String, java.net.URL,
> org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
> org.apache.tapestry.runtime.Component. 
> 
> I am trying to update the search results table when the form is submited
> as an Ajax call. Any ideas ?
> 
> UserPicker.java
> @Inject
> private Block searchResultsBlock;
> 
> Object onSuccessFromUserSearchForm()
> {
>    foundUsers = userManager.findUsers(...);
>    return searchResultsBlock;
> }
> 
> UserPicker.tml
> ...
> <html>
>    <body>
>        <form t:id="userSearchForm" zone="searchResultsZone">
>            ...
>            <input t:type="Submit" value="Find Users"/>
>        </form>
> 
>        <div t:type="Zone" t:id="searchResultZone"/>
> 
>        <div t:type="Block" t:id="searchResultsBlock">
>            <table t:type="Grid" source="foundUsers"/>
>        </div>
>    </body>
> <html>
> 

-- 
View this message in context: http://www.nabble.com/Form-with-a-Zone--%3E-ComponentEventException-tp16346150p16363943.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: Form with a Zone -> ComponentEventException

Posted by "Alex.Hon" <gu...@gmail.com>.
Maybe because IE 
you need edit tapestry.js about linkZone:function...
element.onsubmit = handler; replace to: Event.observe(element, 'submit',
handler);
and element.onclick = handler; replace to:Event.observe(element, 'click',
handler);
and need add line :Event.stop(event);
after new Ajax.Request(element.href, { onSuccess : successHandler });

@see
http://www.prototypejs.org/2007/10/16/prototype-1-6-0-rc1-changes-to-the-class-and-event-apis-hash-rewrite-and-bug-fixes
#Changes to the Event API


Petros Petrou wrote:
> 
> When the userSearchForm of the code below is submitted I am getting the
> following exception
> 
> A component event handler method returned the value
> org.apache.tapestry.internal.structure.BlockImpl@0ada6. Return type
> org.apache.internal.structure.BlockImpl can not be handled. Configured
> return types are java.lang.Class, java.lang.String, java.net.URL,
> org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
> org.apache.tapestry.runtime.Component. 
> 
> I am trying to update the search results table when the form is submited
> as an Ajax call. Any ideas ?
> 
> UserPicker.java
> @Inject
> private Block searchResultsBlock;
> 
> Object onSuccessFromUserSearchForm()
> {
>    foundUsers = userManager.findUsers(...);
>    return searchResultsBlock;
> }
> 
> UserPicker.tml
> ...
> <html>
>    <body>
>        <form t:id="userSearchForm" zone="searchResultsZone">
>            ...
>            <input t:type="Submit" value="Find Users"/>
>        </form>
> 
>        <div t:type="Zone" t:id="searchResultZone"/>
> 
>        <div t:type="Block" t:id="searchResultsBlock">
>            <table t:type="Grid" source="foundUsers"/>
>        </div>
>    </body>
> <html>
> 

-- 
View this message in context: http://www.nabble.com/Form-with-a-Zone--%3E-ComponentEventException-tp16346150p16834687.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