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 Rosemann <al...@gmail.com> on 2011/05/25 18:18:40 UTC
loops, zones and encoders
Hi,
since I am relatively new to zones and all the great stuff that can be
done with them I am stuck with a rather (imho) simple problem.
I render textareas (using a loop) where each of them comes with some
actionlinks. The actionlinks are rendered, again, in a loop. When a user
clicks an action link the related textarea (wrapped in a zone) gets
updated (see the code sample below). So far so good.
<t:form>
<t:loop t:id="criteria" value="currentCriteria" source="criteria"
encoder="cEncoder">
<t:loop t:id="links" value="link" source="links">
<t:actionlink t:id="linkId" zone="prop:uniqueZoneId">some
text</t:actionlink>
</t:loop>
<t:zone t:id="textareaZone" id="prop:uniqueZoneId">
<t:textarea value="textareaValue" />
</t:zone>
</t:loop>
<t:submit value="Save" t:id="save"/>
</t:form>
At the bottom of the page I have a save button which, once clicked,
should save all the data entered/altered in the textareas. The odd thing
is that my encoder for the loop gets called n times before the setter of
my currentCriteria field gets called n times.
Removing the zone brings back the normal behaviour of calling first the
encoder and second, the setter of the corresponding field. Could
somebody shed some light on how to force Tapestry to call the encoder
and setter alternating when the component is in a zone?
I am using Tapestry 5.2.5.
Many thanks,
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: loops, zones and encoders
Posted by Alexander Rosemann <al...@gmail.com>.
Hi,
Thanks for the quick feedback! This is not working for me, since I only
have one submit button outside of the loop.
So I'm still stuck with the problem that first the encoder (cEncoder) is
converting all client values, and afterwards the setters on the text
area (setTextareaValue) are called. If the zone around the text are is
not there, encoder and setter are alternating.
Any ideas appreciated!
Alex
On 25.05.2011 18:28, Taha Hafeez wrote:
> Sorry, defer = false, default is true
>
> regards
> Taha
>
>
> On Wed, May 25, 2011 at 9:57 PM, Taha Hafeez<ta...@gmail.com>wrote:
>
>> Hi
>>
>> Try setting defer = true
>>
>> Check out the defer attribute of submit component.
>>
>> There is a good explaination by Josh here
>>
>>
>> http://tapestry.1045711.n5.nabble.com/submit-context-in-loop-td4398848.html#a4401092
>>
>>
>> <http://tapestry.1045711.n5.nabble.com/submit-context-in-loop-td4398848.html#a4401092>
>> regards
>> Taha
>>
>>
>> On Wed, May 25, 2011 at 9:48 PM, Alexander Rosemann<
>> alexander.rosemann@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> since I am relatively new to zones and all the great stuff that can be
>>> done with them I am stuck with a rather (imho) simple problem.
>>>
>>> I render textareas (using a loop) where each of them comes with some
>>> actionlinks. The actionlinks are rendered, again, in a loop. When a user
>>> clicks an action link the related textarea (wrapped in a zone) gets updated
>>> (see the code sample below). So far so good.
>>>
>>> <t:form>
>>> <t:loop t:id="criteria" value="currentCriteria" source="criteria"
>>> encoder="cEncoder">
>>> <t:loop t:id="links" value="link" source="links">
>>> <t:actionlink t:id="linkId" zone="prop:uniqueZoneId">some
>>> text</t:actionlink>
>>> </t:loop>
>>> <t:zone t:id="textareaZone" id="prop:uniqueZoneId">
>>> <t:textarea value="textareaValue" />
>>> </t:zone>
>>> </t:loop>
>>> <t:submit value="Save" t:id="save"/>
>>> </t:form>
>>>
>>> At the bottom of the page I have a save button which, once clicked, should
>>> save all the data entered/altered in the textareas. The odd thing is that my
>>> encoder for the loop gets called n times before the setter of my
>>> currentCriteria field gets called n times.
>>>
>>> Removing the zone brings back the normal behaviour of calling first the
>>> encoder and second, the setter of the corresponding field. Could somebody
>>> shed some light on how to force Tapestry to call the encoder and setter
>>> alternating when the component is in a zone?
>>>
>>> I am using Tapestry 5.2.5.
>>>
>>> Many thanks,
>>> Alex
>>>
>>> ---------------------------------------------------------------------
>>> 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: loops, zones and encoders
Posted by Alexander Rosemann <al...@gmail.com>.
The (imo) odd behaviour I encounter is that the loop encoder gets
executed ie. 10 times and *after* that the setter method of the textarea
gets called.
I would expect the encoder gets called for textarea1 and then
*immediately* after, the textarea-setter. This works if I remove the
surrounding zone of the textarea but in that case I can't use the
actionlink to update it.
Regards,
Alex
On 25.05.2011 18:28, Taha Hafeez wrote:
> Sorry, defer = false, default is true
>
> regards
> Taha
>
>
> On Wed, May 25, 2011 at 9:57 PM, Taha Hafeez<ta...@gmail.com>wrote:
>
>> Hi
>>
>> Try setting defer = true
>>
>> Check out the defer attribute of submit component.
>>
>> There is a good explaination by Josh here
>>
>>
>> http://tapestry.1045711.n5.nabble.com/submit-context-in-loop-td4398848.html#a4401092
>>
>>
>> <http://tapestry.1045711.n5.nabble.com/submit-context-in-loop-td4398848.html#a4401092>
>> regards
>> Taha
>>
>>
>> On Wed, May 25, 2011 at 9:48 PM, Alexander Rosemann<
>> alexander.rosemann@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> since I am relatively new to zones and all the great stuff that can be
>>> done with them I am stuck with a rather (imho) simple problem.
>>>
>>> I render textareas (using a loop) where each of them comes with some
>>> actionlinks. The actionlinks are rendered, again, in a loop. When a user
>>> clicks an action link the related textarea (wrapped in a zone) gets updated
>>> (see the code sample below). So far so good.
>>>
>>> <t:form>
>>> <t:loop t:id="criteria" value="currentCriteria" source="criteria"
>>> encoder="cEncoder">
>>> <t:loop t:id="links" value="link" source="links">
>>> <t:actionlink t:id="linkId" zone="prop:uniqueZoneId">some
>>> text</t:actionlink>
>>> </t:loop>
>>> <t:zone t:id="textareaZone" id="prop:uniqueZoneId">
>>> <t:textarea value="textareaValue" />
>>> </t:zone>
>>> </t:loop>
>>> <t:submit value="Save" t:id="save"/>
>>> </t:form>
>>>
>>> At the bottom of the page I have a save button which, once clicked, should
>>> save all the data entered/altered in the textareas. The odd thing is that my
>>> encoder for the loop gets called n times before the setter of my
>>> currentCriteria field gets called n times.
>>>
>>> Removing the zone brings back the normal behaviour of calling first the
>>> encoder and second, the setter of the corresponding field. Could somebody
>>> shed some light on how to force Tapestry to call the encoder and setter
>>> alternating when the component is in a zone?
>>>
>>> I am using Tapestry 5.2.5.
>>>
>>> Many thanks,
>>> Alex
>>>
>>> ---------------------------------------------------------------------
>>> 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: loops, zones and encoders
Posted by Taha Hafeez <ta...@gmail.com>.
Sorry, defer = false, default is true
regards
Taha
On Wed, May 25, 2011 at 9:57 PM, Taha Hafeez <ta...@gmail.com>wrote:
> Hi
>
> Try setting defer = true
>
> Check out the defer attribute of submit component.
>
> There is a good explaination by Josh here
>
>
> http://tapestry.1045711.n5.nabble.com/submit-context-in-loop-td4398848.html#a4401092
>
>
> <http://tapestry.1045711.n5.nabble.com/submit-context-in-loop-td4398848.html#a4401092>
> regards
> Taha
>
>
> On Wed, May 25, 2011 at 9:48 PM, Alexander Rosemann <
> alexander.rosemann@gmail.com> wrote:
>
>> Hi,
>>
>> since I am relatively new to zones and all the great stuff that can be
>> done with them I am stuck with a rather (imho) simple problem.
>>
>> I render textareas (using a loop) where each of them comes with some
>> actionlinks. The actionlinks are rendered, again, in a loop. When a user
>> clicks an action link the related textarea (wrapped in a zone) gets updated
>> (see the code sample below). So far so good.
>>
>> <t:form>
>> <t:loop t:id="criteria" value="currentCriteria" source="criteria"
>> encoder="cEncoder">
>> <t:loop t:id="links" value="link" source="links">
>> <t:actionlink t:id="linkId" zone="prop:uniqueZoneId">some
>> text</t:actionlink>
>> </t:loop>
>> <t:zone t:id="textareaZone" id="prop:uniqueZoneId">
>> <t:textarea value="textareaValue" />
>> </t:zone>
>> </t:loop>
>> <t:submit value="Save" t:id="save"/>
>> </t:form>
>>
>> At the bottom of the page I have a save button which, once clicked, should
>> save all the data entered/altered in the textareas. The odd thing is that my
>> encoder for the loop gets called n times before the setter of my
>> currentCriteria field gets called n times.
>>
>> Removing the zone brings back the normal behaviour of calling first the
>> encoder and second, the setter of the corresponding field. Could somebody
>> shed some light on how to force Tapestry to call the encoder and setter
>> alternating when the component is in a zone?
>>
>> I am using Tapestry 5.2.5.
>>
>> Many thanks,
>> Alex
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
Re: loops, zones and encoders
Posted by Taha Hafeez <ta...@gmail.com>.
Hi
Try setting defer = true
Check out the defer attribute of submit component.
There is a good explaination by Josh here
http://tapestry.1045711.n5.nabble.com/submit-context-in-loop-td4398848.html#a4401092
<http://tapestry.1045711.n5.nabble.com/submit-context-in-loop-td4398848.html#a4401092>
regards
Taha
On Wed, May 25, 2011 at 9:48 PM, Alexander Rosemann <
alexander.rosemann@gmail.com> wrote:
> Hi,
>
> since I am relatively new to zones and all the great stuff that can be done
> with them I am stuck with a rather (imho) simple problem.
>
> I render textareas (using a loop) where each of them comes with some
> actionlinks. The actionlinks are rendered, again, in a loop. When a user
> clicks an action link the related textarea (wrapped in a zone) gets updated
> (see the code sample below). So far so good.
>
> <t:form>
> <t:loop t:id="criteria" value="currentCriteria" source="criteria"
> encoder="cEncoder">
> <t:loop t:id="links" value="link" source="links">
> <t:actionlink t:id="linkId" zone="prop:uniqueZoneId">some
> text</t:actionlink>
> </t:loop>
> <t:zone t:id="textareaZone" id="prop:uniqueZoneId">
> <t:textarea value="textareaValue" />
> </t:zone>
> </t:loop>
> <t:submit value="Save" t:id="save"/>
> </t:form>
>
> At the bottom of the page I have a save button which, once clicked, should
> save all the data entered/altered in the textareas. The odd thing is that my
> encoder for the loop gets called n times before the setter of my
> currentCriteria field gets called n times.
>
> Removing the zone brings back the normal behaviour of calling first the
> encoder and second, the setter of the corresponding field. Could somebody
> shed some light on how to force Tapestry to call the encoder and setter
> alternating when the component is in a zone?
>
> I am using Tapestry 5.2.5.
>
> Many thanks,
> Alex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>