You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nicolas Bouillon <ni...@bouil.org> on 2012/10/22 14:11:38 UTC

Tree and Form submission to Zone problem

Hi,

We have got a problem with the Tree component.

In our tree element, we want to have a form included to allow to add a
new child to the current element. We have used the p:label attribute
to customize the rendering of the element, and we have included a form
inside, which must submit in XHR to a zone.

The problem all but the last item on the tree triggers a plain old
form submission with a full reload.
The last item trigger a XHR submit but for all the displayed items in
the tree at the time the page loads (so not taking into account the
dynamically expanded elements).

If you look at the source code generated at the bottom of the page,
you can see the linkId is always the same for each form element :

  "linkZone" : [
    {
      "linkId" : "form_2",
      "url" : "/index.form/Pets",
      "zoneId" : "zone"
    },
    {
      "linkId" : "form_2",
      "url" : "/index.form/Games",
      "zoneId" : "zone"
    },
    {
      "linkId" : "form_2",
      "url" : "/index.form/Numbers",
      "zoneId" : "zone"
    },
    {
      "linkId" : "form_2",
      "url" : "/index.form/Last$0020element",
      "zoneId" : "zone"
    }
  ],

I've setup a sample project on github at
https://github.com/bouil/tapestry-tree-test

The problem can be live tested at http://tapestry-tree-test.cloudfoundry.com/

Thank you for any help and workaround you could provide to solve this problem.

Nicolas.

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


Re: Tree and Form submission to Zone problem

Posted by Nicolas Bouillon <ni...@bouil.org>.
FYI, here is the way I solved my problem. Looks not very beautiful,
but it works.

Not sure if I may have to open a JIRA about this.

On Thu, Oct 25, 2012 at 11:16 AM, Nicolas Bouillon <ni...@bouil.org> wrote:
> Sorry for the noise, but I figured out that in Form.java, the code
>             clientBehaviorSupport.linkZone(getClientId(), zone, link);
> is @HeartbeatDeferred, and it's not the case in AbstractComponentEventLink.
>
> This deferred execution makes the Form to use the last clientId
> generated inside the tree loop, instead of the clientId generated for
> this specific loop.
>
> Trying with a Loop component, the problem doesn't occurs because the
> Loop component seems to correctly work together the Heartbeat service.
>
> On Thu, Oct 25, 2012 at 10:58 AM, Nicolas Bouillon <ni...@bouil.org> wrote:
>> I tried to dig inside the Tree component source, and I'm not really at
>> ease with the RenderCommand way to render stuffs.
>>
>> What I see is the block I overridden to display a form with zone
>> update submit inside, is pushed to the RenderQueue. But I don't
>> understand how this affect the way the form generates the javascript
>> needed to behave correctly.
>>
>> I tried with and this way it behave correctly, so it seams to be
>> specific to the form component.
>>
>> Any help ?
>>
>>
>> On Mon, Oct 22, 2012 at 2:11 PM, Nicolas Bouillon <ni...@bouil.org> wrote:
>>> Hi,
>>>
>>> We have got a problem with the Tree component.
>>>
>>> In our tree element, we want to have a form included to allow to add a
>>> new child to the current element. We have used the p:label attribute
>>> to customize the rendering of the element, and we have included a form
>>> inside, which must submit in XHR to a zone.
>>>
>>> The problem all but the last item on the tree triggers a plain old
>>> form submission with a full reload.
>>> The last item trigger a XHR submit but for all the displayed items in
>>> the tree at the time the page loads (so not taking into account the
>>> dynamically expanded elements).
>>>
>>> If you look at the source code generated at the bottom of the page,
>>> you can see the linkId is always the same for each form element :
>>>
>>>   "linkZone" : [
>>>     {
>>>       "linkId" : "form_2",
>>>       "url" : "/index.form/Pets",
>>>       "zoneId" : "zone"
>>>     },
>>>     {
>>>       "linkId" : "form_2",
>>>       "url" : "/index.form/Games",
>>>       "zoneId" : "zone"
>>>     },
>>>     {
>>>       "linkId" : "form_2",
>>>       "url" : "/index.form/Numbers",
>>>       "zoneId" : "zone"
>>>     },
>>>     {
>>>       "linkId" : "form_2",
>>>       "url" : "/index.form/Last$0020element",
>>>       "zoneId" : "zone"
>>>     }
>>>   ],
>>>
>>> I've setup a sample project on github at
>>> https://github.com/bouil/tapestry-tree-test
>>>
>>> The problem can be live tested at http://tapestry-tree-test.cloudfoundry.com/
>>>
>>> Thank you for any help and workaround you could provide to solve this problem.
>>>
>>> Nicolas.


Re: Tree and Form submission to Zone problem

Posted by Nicolas Bouillon <ni...@bouil.org>.
Sorry for the noise, but I figured out that in Form.java, the code
            clientBehaviorSupport.linkZone(getClientId(), zone, link);
is @HeartbeatDeferred, and it's not the case in AbstractComponentEventLink.

This deferred execution makes the Form to use the last clientId
generated inside the tree loop, instead of the clientId generated for
this specific loop.

Trying with a Loop component, the problem doesn't occurs because the
Loop component seems to correctly work together the Heartbeat service.

On Thu, Oct 25, 2012 at 10:58 AM, Nicolas Bouillon <ni...@bouil.org> wrote:
> I tried to dig inside the Tree component source, and I'm not really at
> ease with the RenderCommand way to render stuffs.
>
> What I see is the block I overridden to display a form with zone
> update submit inside, is pushed to the RenderQueue. But I don't
> understand how this affect the way the form generates the javascript
> needed to behave correctly.
>
> I tried with and this way it behave correctly, so it seams to be
> specific to the form component.
>
> Any help ?
>
>
> On Mon, Oct 22, 2012 at 2:11 PM, Nicolas Bouillon <ni...@bouil.org> wrote:
>> Hi,
>>
>> We have got a problem with the Tree component.
>>
>> In our tree element, we want to have a form included to allow to add a
>> new child to the current element. We have used the p:label attribute
>> to customize the rendering of the element, and we have included a form
>> inside, which must submit in XHR to a zone.
>>
>> The problem all but the last item on the tree triggers a plain old
>> form submission with a full reload.
>> The last item trigger a XHR submit but for all the displayed items in
>> the tree at the time the page loads (so not taking into account the
>> dynamically expanded elements).
>>
>> If you look at the source code generated at the bottom of the page,
>> you can see the linkId is always the same for each form element :
>>
>>   "linkZone" : [
>>     {
>>       "linkId" : "form_2",
>>       "url" : "/index.form/Pets",
>>       "zoneId" : "zone"
>>     },
>>     {
>>       "linkId" : "form_2",
>>       "url" : "/index.form/Games",
>>       "zoneId" : "zone"
>>     },
>>     {
>>       "linkId" : "form_2",
>>       "url" : "/index.form/Numbers",
>>       "zoneId" : "zone"
>>     },
>>     {
>>       "linkId" : "form_2",
>>       "url" : "/index.form/Last$0020element",
>>       "zoneId" : "zone"
>>     }
>>   ],
>>
>> I've setup a sample project on github at
>> https://github.com/bouil/tapestry-tree-test
>>
>> The problem can be live tested at http://tapestry-tree-test.cloudfoundry.com/
>>
>> Thank you for any help and workaround you could provide to solve this problem.
>>
>> Nicolas.

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


Re: Tree and Form submission to Zone problem

Posted by Nicolas Bouillon <ni...@bouil.org>.
I tried to dig inside the Tree component source, and I'm not really at
ease with the RenderCommand way to render stuffs.

What I see is the block I overridden to display a form with zone
update submit inside, is pushed to the RenderQueue. But I don't
understand how this affect the way the form generates the javascript
needed to behave correctly.

I tried with and this way it behave correctly, so it seams to be
specific to the form component.

Any help ?


On Mon, Oct 22, 2012 at 2:11 PM, Nicolas Bouillon <ni...@bouil.org> wrote:
> Hi,
>
> We have got a problem with the Tree component.
>
> In our tree element, we want to have a form included to allow to add a
> new child to the current element. We have used the p:label attribute
> to customize the rendering of the element, and we have included a form
> inside, which must submit in XHR to a zone.
>
> The problem all but the last item on the tree triggers a plain old
> form submission with a full reload.
> The last item trigger a XHR submit but for all the displayed items in
> the tree at the time the page loads (so not taking into account the
> dynamically expanded elements).
>
> If you look at the source code generated at the bottom of the page,
> you can see the linkId is always the same for each form element :
>
>   "linkZone" : [
>     {
>       "linkId" : "form_2",
>       "url" : "/index.form/Pets",
>       "zoneId" : "zone"
>     },
>     {
>       "linkId" : "form_2",
>       "url" : "/index.form/Games",
>       "zoneId" : "zone"
>     },
>     {
>       "linkId" : "form_2",
>       "url" : "/index.form/Numbers",
>       "zoneId" : "zone"
>     },
>     {
>       "linkId" : "form_2",
>       "url" : "/index.form/Last$0020element",
>       "zoneId" : "zone"
>     }
>   ],
>
> I've setup a sample project on github at
> https://github.com/bouil/tapestry-tree-test
>
> The problem can be live tested at http://tapestry-tree-test.cloudfoundry.com/
>
> Thank you for any help and workaround you could provide to solve this problem.
>
> Nicolas.

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