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 Petrou <pe...@cypoz.com> on 2008/04/03 13:39:02 UTC

ComponentEventException on Form Submit with Ajax

The form below works fine when the Submit button is pressed but the exception
below is thrown when the myRadioButton is selected. It looks like the
onclick="this.form.submit()" is making it fail. Any ideas how I can solve
this ?


org.apache.tapestry.runtime.ComponentEventException
Return type org.apache.tapestry.internal.structure.BlockImpl can not be
handled. 

MyPage.tml
<form t:id="myForm" zone="myZone">
   ... 
   <t:radio t:id="myRadioButton" onclick="this.form.submit()"/>
   ...
    <input t:type="submit"/>
</form>
<t:zone t:id="myZone">
   <t:block t:id="myBlock">
        ..... some text ...
   </t:block>
</t:zone>
MyPage.java
public class MyPage
{

    @Inject
    private Block myBlock;
...
   public void onSuccessFromMyForm()
   {
      return myBlock;
    
   }
}
-- 
View this message in context: http://www.nabble.com/ComponentEventException-on-Form-Submit-with-Ajax-tp16467413p16467413.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: ComponentEventException on Form Submit with Ajax

Posted by Stephane Decleire <sd...@cariboo-networks.com>.
I think there's a good sample in the Tap 5 documentation :
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Delegate.html

Stephane

Dmitry Shyshkin a écrit :
> What do you want to achieve by returning Block from onSucess event?
> As you can read from 
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html 
> Block is not a valid return value for listener method.
>
> P.S.
> I think it is a typo, but you return myBlock from method as declared 
> as _void_.
>
> Petros Petrou пишет:
>> The form below works fine when the Submit button is pressed but the 
>> exception
>> below is thrown when the myRadioButton is selected. It looks like the
>> onclick="this.form.submit()" is making it fail. Any ideas how I can 
>> solve
>> this ?
>>
>>
>> org.apache.tapestry.runtime.ComponentEventException
>> Return type org.apache.tapestry.internal.structure.BlockImpl can not be
>> handled.
>> MyPage.tml
>> <form t:id="myForm" zone="myZone">
>>    ...    <t:radio t:id="myRadioButton" onclick="this.form.submit()"/>
>>    ...
>>     <input t:type="submit"/>
>> </form>
>> <t:zone t:id="myZone">
>>    <t:block t:id="myBlock">
>>         ..... some text ...
>>    </t:block>
>> </t:zone>
>> MyPage.java
>> public class MyPage
>> {
>>
>>     @Inject
>>     private Block myBlock;
>> ...
>>    public void onSuccessFromMyForm()
>>    {
>>       return myBlock;
>>        }
>> }
>>   
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

Re: ComponentEventException on Form Submit with Ajax

Posted by Dmitry Shyshkin <sh...@devoler.com>.
You can return Block or Component from listener only when tapestry is 
precessing _ajax_ request. 'this.form.submit()' is not an ajax.
As I know currently there is no ajax support for radio button (may be I 
am wrong), but you can look into code of TriggerFragment mixin and adopt
this code for radio button.

Petros Petrou пишет:
> Yes returning void is a typo. 
> What I am trying to achieve is the following: 
> I have two versions of a searchCriteriaForm. 
> I have a second form (configureSearchCriteriaForm) that contains two radio
> buttons. Depending on which radio button is selected an "onclick" event
> submits this form to decide which searchCriteriaForm will be used. The
> searchCriteriaForm is contained in a zone. Now, when the searchCriteriaForm
> is submitted another zone is updated (searchResultsZone) that contains a
> Grid component. The code below should make everything clearer. 
>
> Configure search criteria
> <t:form t:id="configureSearchCriteriaForm" zone="searchCriteriaZone">
>        <t:radio t:id="searchCriteria1" onclick="this.form.submit()"/>
>        <t:radio t:id="searchCriteria1" onclick="this.form.submit()"/>
>        <!-- onSuccess of this form the block searchCriteriaBlock is
> returned-->
> </t:form>
>
> Specify search criteria
> <t:zone t:id="searchCriteriaZone">
>    <t:block t:id="searchCriteriaBlock">
>       <t:form t:id="searchCriteriaForm" zone="searchResultsZone">       
>              <!-- onSuccess of this form the block searchResultsBlock is
> returned and this works fine if the searchCriteriaZone and
> searchCriteriaForm are returned
>       </t:form>
>    </t:block>
> <t:zone>
>
> Display search results
> <t:zone t:id="searchResultsZone">
>    <t:block t:id="searchResultsBlock">
>       <t:grid source="foundEntitiesList"/>
>    </t:block>
> </t:zone>
>
> Petros
>
>   

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


Re: ComponentEventException on Form Submit with Ajax

Posted by Petros Petrou <pe...@cypoz.com>.
Yes returning void is a typo. 
What I am trying to achieve is the following: 
I have two versions of a searchCriteriaForm. 
I have a second form (configureSearchCriteriaForm) that contains two radio
buttons. Depending on which radio button is selected an "onclick" event
submits this form to decide which searchCriteriaForm will be used. The
searchCriteriaForm is contained in a zone. Now, when the searchCriteriaForm
is submitted another zone is updated (searchResultsZone) that contains a
Grid component. The code below should make everything clearer. 

Configure search criteria
<t:form t:id="configureSearchCriteriaForm" zone="searchCriteriaZone">
       <t:radio t:id="searchCriteria1" onclick="this.form.submit()"/>
       <t:radio t:id="searchCriteria1" onclick="this.form.submit()"/>
       <!-- onSuccess of this form the block searchCriteriaBlock is
returned-->
</t:form>

Specify search criteria
<t:zone t:id="searchCriteriaZone">
   <t:block t:id="searchCriteriaBlock">
      <t:form t:id="searchCriteriaForm" zone="searchResultsZone">       
             <!-- onSuccess of this form the block searchResultsBlock is
returned and this works fine if the searchCriteriaZone and
searchCriteriaForm are returned
      </t:form>
   </t:block>
<t:zone>

Display search results
<t:zone t:id="searchResultsZone">
   <t:block t:id="searchResultsBlock">
      <t:grid source="foundEntitiesList"/>
   </t:block>
</t:zone>

Petros


Dmitry Shyshkin wrote:
> 
> What do you want to achieve by returning Block from onSucess event?
> As you can read from 
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html 
> Block is not a valid return value for listener method.
> 
> P.S.
> I think it is a typo, but you return myBlock from method as declared as 
> _void_.
> 
> Petros Petrou пишет:
>> The form below works fine when the Submit button is pressed but the
>> exception
>> below is thrown when the myRadioButton is selected. It looks like the
>> onclick="this.form.submit()" is making it fail. Any ideas how I can solve
>> this ?
>>
>>
>> org.apache.tapestry.runtime.ComponentEventException
>> Return type org.apache.tapestry.internal.structure.BlockImpl can not be
>> handled. 
>>
>> MyPage.tml
>> <form t:id="myForm" zone="myZone">
>>    ... 
>>    <t:radio t:id="myRadioButton" onclick="this.form.submit()"/>
>>    ...
>>     <input t:type="submit"/>
>> </form>
>> <t:zone t:id="myZone">
>>    <t:block t:id="myBlock">
>>         ..... some text ...
>>    </t:block>
>> </t:zone>
>> MyPage.java
>> public class MyPage
>> {
>>
>>     @Inject
>>     private Block myBlock;
>> ...
>>    public void onSuccessFromMyForm()
>>    {
>>       return myBlock;
>>     
>>    }
>> }
>>   
> 
> 
> ---------------------------------------------------------------------
> 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/ComponentEventException-on-Form-Submit-with-Ajax-tp16467413p16476107.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: ComponentEventException on Form Submit with Ajax

Posted by Dmitry Shyshkin <sh...@devoler.com>.
What do you want to achieve by returning Block from onSucess event?
As you can read from 
http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html 
Block is not a valid return value for listener method.

P.S.
I think it is a typo, but you return myBlock from method as declared as 
_void_.

Petros Petrou пишет:
> The form below works fine when the Submit button is pressed but the exception
> below is thrown when the myRadioButton is selected. It looks like the
> onclick="this.form.submit()" is making it fail. Any ideas how I can solve
> this ?
>
>
> org.apache.tapestry.runtime.ComponentEventException
> Return type org.apache.tapestry.internal.structure.BlockImpl can not be
> handled. 
>
> MyPage.tml
> <form t:id="myForm" zone="myZone">
>    ... 
>    <t:radio t:id="myRadioButton" onclick="this.form.submit()"/>
>    ...
>     <input t:type="submit"/>
> </form>
> <t:zone t:id="myZone">
>    <t:block t:id="myBlock">
>         ..... some text ...
>    </t:block>
> </t:zone>
> MyPage.java
> public class MyPage
> {
>
>     @Inject
>     private Block myBlock;
> ...
>    public void onSuccessFromMyForm()
>    {
>       return myBlock;
>     
>    }
> }
>   


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