You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by lyf <yi...@gmail.com> on 2010/01/21 13:34:04 UTC

How to return a component without a form (T5.1.05)

The page template looks like:
...
<t:form t:id="theForm" zone="listZone">
    <table>
         <t:zone t:id="listZone"/>
         <tr>
             <td><t:submit /></td>             
         </tr>
    </table>
    <t:block><t:myComponent t:id="myComponent"/></t:block>
</t:form>

page class:
class Index {
   @InjectComponent
    private MyComponent myComponent;

    Object onSuccess() {
       return this.myComponent;
    }
}


MyComponent template:
<tr>
    <td><t:select t:id="list" label="List" blankOption="never"
				model="objects" encoder="objects" value="object" /></td>
</tr>

MyComponent Class:
class MyComponent {
......
}

When I click submit button, I got a error: Render queue error in
SetupRender[Index: myComponent.list]: The List component must be enclosed by
a Form component.

What's wrong? How can I implement this feature?
-- 
View this message in context: http://old.nabble.com/How-to-return-a-%3Ct%3Aselect%3E-component-without-a-form-%28T5.1.05%29-tp27257016p27257016.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: How to return a component without a form (T5.1.05)

Posted by lyf <yi...@gmail.com>.

Thanks for replying. But I've abandoned ajax.



Inge Solvoll-2 wrote:
> 
> This limitation has been a blocker for me too. All form components need to
> be enclosed by a form in the same template.
> 
> I guess you need to use some other strategy, for example by subclassing
> the
> select component? I would like to se some nice suggestions on this, as
> this
> is a real requirement for me too.
> 
> On Thu, Jan 21, 2010 at 1:34 PM, lyf <yi...@gmail.com> wrote:
> 
>>
>> The page template looks like:
>> ...
>> <t:form t:id="theForm" zone="listZone">
>>    <table>
>>         <t:zone t:id="listZone"/>
>>         <tr>
>>             <td><t:submit /></td>
>>         </tr>
>>    </table>
>>    <t:block><t:myComponent t:id="myComponent"/></t:block>
>> </t:form>
>>
>> page class:
>> class Index {
>>   @InjectComponent
>>    private MyComponent myComponent;
>>
>>    Object onSuccess() {
>>       return this.myComponent;
>>    }
>> }
>>
>>
>> MyComponent template:
>> <tr>
>>    <td><t:select t:id="list" label="List" blankOption="never"
>>                                model="objects" encoder="objects"
>> value="object" /></td>
>> </tr>
>>
>> MyComponent Class:
>> class MyComponent {
>> ......
>> }
>>
>> When I click submit button, I got a error: Render queue error in
>> SetupRender[Index: myComponent.list]: The List component must be enclosed
>> by
>> a Form component.
>>
>> What's wrong? How can I implement this feature?
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-return-a-%3Ct%3Aselect%3E-component-without-a-form-%28T5.1.05%29-tp27257016p27257016.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
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-return-a-%3Ct%3Aselect%3E-component-without-a-form-%28T5.1.05%29-tp27257016p27259021.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: How to return a component without a form (T5.1.05)

Posted by Robert Zeigler <ro...@scazdl.org>.
It's not quite true, but close enough.
All form components have to have a FormSupport environmental object  
available when they render.  So you can have form fields that are in  
blocks on non-rendering pages and pull those blocks into the rendering  
page and everything works fine.  The problem occurs when you do an  
ajax request where you want to update some small portion of the page,  
itself contained within a form, with some form-based content.  In that  
case, the "naive" solution will fail. Eg:

<t:form>
   ...
   <t:zone ...><!-- some zone to be updated via ajax, within the form;  
we want it to render form fields. --></t:zone>
   ...
</t:form>

When you update the zone with some form-field-containing content,  
you'll get a failure because the form fields won't have a FormSupport  
object available to them in the environment.

This is what, eg, the FormInjector component tries to solve.   
Unfortunately, it seems geared toward use with, eg, AjaxFormLoop.  In  
any event, it's a bit unwieldy to use on its own.

Robert

On Jan 21, 2010, at 1/219:35 AM , Andreas Andreou wrote:

> On Thu, Jan 21, 2010 at 16:47, Inge Solvoll  
> <in...@gmail.com> wrote:
>> This limitation has been a blocker for me too. All form components  
>> need to
>> be enclosed by a form in the same template.
>
> Is that true? Anyone knows if there's a reason for this? Cause
> otherwise, you should
> file a bug report
>
> ---------------------------------------------------------------------
> 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: How to return a component without a form (T5.1.05)

Posted by Inge Solvoll <in...@gmail.com>.
Sorry, it's not true, my mistake. As long as the input doesn't depend on
form events, it can be placed in a sub-component.

On Thu, Jan 21, 2010 at 4:35 PM, Andreas Andreou <an...@di.uoa.gr> wrote:

> On Thu, Jan 21, 2010 at 16:47, Inge Solvoll <in...@gmail.com>
> wrote:
> > This limitation has been a blocker for me too. All form components need
> to
> > be enclosed by a form in the same template.
>
> Is that true? Anyone knows if there's a reason for this? Cause
> otherwise, you should
> file a bug report
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: How to return a component without a form (T5.1.05)

Posted by Andreas Andreou <an...@di.uoa.gr>.
On Thu, Jan 21, 2010 at 16:47, Inge Solvoll <in...@gmail.com> wrote:
> This limitation has been a blocker for me too. All form components need to
> be enclosed by a form in the same template.

Is that true? Anyone knows if there's a reason for this? Cause
otherwise, you should
file a bug report

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


Re: How to return a component without a form (T5.1.05)

Posted by Inge Solvoll <in...@gmail.com>.
This limitation has been a blocker for me too. All form components need to
be enclosed by a form in the same template.

I guess you need to use some other strategy, for example by subclassing the
select component? I would like to se some nice suggestions on this, as this
is a real requirement for me too.

On Thu, Jan 21, 2010 at 1:34 PM, lyf <yi...@gmail.com> wrote:

>
> The page template looks like:
> ...
> <t:form t:id="theForm" zone="listZone">
>    <table>
>         <t:zone t:id="listZone"/>
>         <tr>
>             <td><t:submit /></td>
>         </tr>
>    </table>
>    <t:block><t:myComponent t:id="myComponent"/></t:block>
> </t:form>
>
> page class:
> class Index {
>   @InjectComponent
>    private MyComponent myComponent;
>
>    Object onSuccess() {
>       return this.myComponent;
>    }
> }
>
>
> MyComponent template:
> <tr>
>    <td><t:select t:id="list" label="List" blankOption="never"
>                                model="objects" encoder="objects"
> value="object" /></td>
> </tr>
>
> MyComponent Class:
> class MyComponent {
> ......
> }
>
> When I click submit button, I got a error: Render queue error in
> SetupRender[Index: myComponent.list]: The List component must be enclosed
> by
> a Form component.
>
> What's wrong? How can I implement this feature?
> --
> View this message in context:
> http://old.nabble.com/How-to-return-a-%3Ct%3Aselect%3E-component-without-a-form-%28T5.1.05%29-tp27257016p27257016.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
>
>