You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Toby Hobson <to...@googlemail.com> on 2008/10/09 13:12:44 UTC
Problem updating form using a zone
Can anyone see anything wrong with my code?
<t:zone t:id="formzone">
<h3>
<t:form t:id="form" style="display:inline"
t:zone="formzone">
<strong>Public:</strong>
<t:if test="gallery.publicGallery">
<input type="image"
src="${asset:context:images/green_tick.png}" alt="yes"
style="vertical-align:middle;padding-left:5px" />
</t:if>
<t:unless test="gallery.publicGallery">
<input type="image"
src="${asset:context:images/red_cross.png}" alt="no"
style="vertical-align:middle;padding-left:5px" />
</t:unless>
</t:form>
</h3>
</t:zone>
void onSuccess() {
gallery.setPublicGallery(! gallery.isPublicGallery());
galleryService.update(gallery);
}
Basically i display a tick if the gallery.publicGallery is true and a cross
if it's false. Clicking on the tick/cross changes the state. This works fine
using a conventional submit but adding the ajax stuff just gives me an empty
div when the form is submitted
I'm sure it's something simple i've missed
Thanks!
Re: Problem updating form using a zone
Posted by Toby Hobson <to...@googlemail.com>.
Thanks for clarifying that hugo ... all is working well now
2008/10/9 Hugo Palma <hu...@gmail.com>
> The event listener method has to return the component or block that you
> want to render inside the block. If the method returns nothing like your
> example than the whole contents of the zone will be empty, like you say.
>
> That's just how the zone works, it renders the returned component/block and
> places the rendered content inside the zone tag replacing the existing
> content.
>
>
> Toby Hobson wrote:
>
>> Can anyone see anything wrong with my code?
>>
>> <t:zone t:id="formzone">
>> <h3>
>> <t:form t:id="form" style="display:inline"
>> t:zone="formzone">
>> <strong>Public:</strong>
>> <t:if test="gallery.publicGallery">
>> <input type="image"
>> src="${asset:context:images/green_tick.png}" alt="yes"
>> style="vertical-align:middle;padding-left:5px" />
>> </t:if>
>> <t:unless test="gallery.publicGallery">
>> <input type="image"
>> src="${asset:context:images/red_cross.png}" alt="no"
>> style="vertical-align:middle;padding-left:5px" />
>> </t:unless>
>> </t:form>
>> </h3>
>> </t:zone>
>>
>> void onSuccess() {
>> gallery.setPublicGallery(! gallery.isPublicGallery());
>> galleryService.update(gallery);
>> }
>>
>> Basically i display a tick if the gallery.publicGallery is true and a
>> cross
>> if it's false. Clicking on the tick/cross changes the state. This works
>> fine
>> using a conventional submit but adding the ajax stuff just gives me an
>> empty
>> div when the form is submitted
>>
>> I'm sure it's something simple i've missed
>>
>> Thanks!
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: Problem updating form using a zone
Posted by Hugo Palma <hu...@gmail.com>.
The event listener method has to return the component or block that you
want to render inside the block. If the method returns nothing like your
example than the whole contents of the zone will be empty, like you say.
That's just how the zone works, it renders the returned component/block
and places the rendered content inside the zone tag replacing the
existing content.
Toby Hobson wrote:
> Can anyone see anything wrong with my code?
>
> <t:zone t:id="formzone">
> <h3>
> <t:form t:id="form" style="display:inline"
> t:zone="formzone">
> <strong>Public:</strong>
> <t:if test="gallery.publicGallery">
> <input type="image"
> src="${asset:context:images/green_tick.png}" alt="yes"
> style="vertical-align:middle;padding-left:5px" />
> </t:if>
> <t:unless test="gallery.publicGallery">
> <input type="image"
> src="${asset:context:images/red_cross.png}" alt="no"
> style="vertical-align:middle;padding-left:5px" />
> </t:unless>
> </t:form>
> </h3>
> </t:zone>
>
> void onSuccess() {
> gallery.setPublicGallery(! gallery.isPublicGallery());
> galleryService.update(gallery);
> }
>
> Basically i display a tick if the gallery.publicGallery is true and a cross
> if it's false. Clicking on the tick/cross changes the state. This works fine
> using a conventional submit but adding the ajax stuff just gives me an empty
> div when the form is submitted
>
> I'm sure it's something simple i've missed
>
> Thanks!
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Problem updating form using a zone
Posted by Stephane Decleire <sd...@cariboo-networks.com>.
Your success event handler should return a block of HTML by returning a
Block or a Tapestry Component.
If you don't return anything, nothing is shown ...
Stephane
Toby Hobson a écrit :
> Can anyone see anything wrong with my code?
>
> <t:zone t:id="formzone">
> <h3>
> <t:form t:id="form" style="display:inline"
> t:zone="formzone">
> <strong>Public:</strong>
> <t:if test="gallery.publicGallery">
> <input type="image"
> src="${asset:context:images/green_tick.png}" alt="yes"
> style="vertical-align:middle;padding-left:5px" />
> </t:if>
> <t:unless test="gallery.publicGallery">
> <input type="image"
> src="${asset:context:images/red_cross.png}" alt="no"
> style="vertical-align:middle;padding-left:5px" />
> </t:unless>
> </t:form>
> </h3>
> </t:zone>
>
> void onSuccess() {
> gallery.setPublicGallery(! gallery.isPublicGallery());
> galleryService.update(gallery);
> }
>
> Basically i display a tick if the gallery.publicGallery is true and a cross
> if it's false. Clicking on the tick/cross changes the state. This works fine
> using a conventional submit but adding the ajax stuff just gives me an empty
> div when the form is submitted
>
> I'm sure it's something simple i've missed
>
> Thanks!
>
>