Re: [T5] Form and Zone inside a loop
Well I eventually got to the root of this. The problem was being caused because the IDs I'd given to my zones started witha number! Changing them from 1_1Zone to Zone1_1 fixed the issue. Also got this working with MultiZoneUpdate now, I love this component. Great job by the Tapestry devs. -- View this message in context: http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27417440.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Form and Zone inside a loop
Hi, You have to find what is failing on the client side. If a submit action refreshes the whole page, this means that the zone has not been initialized. So i guess firebug or any other tool should help you. Also, you may use class="t-zone-update" on the element that must be refreshed by the zone, the structure will look like this : Regards, Christophe Developer of wooki @wookicentral.com 2010/2/1 lebenski > > Yes, this is what I have: > > > > >public String getZoneId() { >return draftPick.getPackNumber() + "_" + > draftPick.getPickNumber() + > "Zone"; >} > > Giving all of my zones id's like this 1_7Zone > > > I've also tried removing the t: prefix from the zone parameter, this seems > to make no difference. > > > Ulrich Stärk wrote: > > > > Normally that happens when zone and form aren't set up correctly on the > > client side, e.g. due to > > inconsistent IDs. > > > > Did you try as Christophe suggested? Replace t:zone="${zoneId}" with > > t:zone="prop:zoneId" (same for > > the id parameter of zone). Does that help? > > > > Uli > > > > On 01.02.2010 12:15 schrieb lebenski: > >> > >> Ah! this seems to have got to the root of the problem. Request.isXHR() > >> is > >> returning false. I understand that this method is looking for the > >> presence > >> of an Http Header called X-Requested-With with the value XMLHttpRequest. > >> Snooping the request I notice that this has not been set. How does this > >> header get set, and what in my example could cause this not to be > getting > >> set? > >> > >> > >> Ulrich Stärk wrote: > >>> > >>> You should @InjectComponent private Zone otherCommentsZone and return > >>> otherCommentsZone.getBody() > >>> from your onSuccess handler method after checking whether this is a XHR > >>> request (@Inject Request and > >>> do request.isXHR()). > >>> > >>> Uli > >>> > >>> On 01.02.2010 09:29 schrieb lebenski: > >>>> > >>>> I have a loop that contains a form and a zone. In each iteration of > >>>> the > >>>> loop, submission of that form should update it's relevant zone: > >>>> > >>>> > >>>> >>>> t:zone="${zoneId}"> > >>>> ... > >>>> > >>>> > >>>> > >>>> > >>>> ... > >>>> > >>>> > >>>> > >>>> > >>>>Object onSuccessFromPickCommentForm(DraftPick draftPick) { > >>>>createPickComment(draft.get(draftPick.getPackNumber(), > >>>> draftPick.getPickNumber())); > >>>> > >>>>loadDraft(); > >>>> > >>>>return otherCommentsZone; > >>>>} > >>>> > >>>> So i'm binding the zone parameter of the form to the generated client > >>>> id > >>>> (not the component id) as suggested in the documentation here: > >>>> > >>>> > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html > >>>> > >>>> After I submit the form the page refreshes rather that updating the > >>>> zone. > >>>> The loop runs 45 times so I end up with 45 micro forms and 45 zones on > >>>> my > >>>> page. Can anyone see what I'm doing wrong here? > >>> > >>> - > >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >>> For additional commands, e-mail: users-h...@tapestry.apache.org > >>> > >>> > >>> > >> > > > > - > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > > > -- > View this message in context: > http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27403412.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: [T5] Form and Zone inside a loop
Yes, this is what I have: public String getZoneId() { return draftPick.getPackNumber() + "_" + draftPick.getPickNumber() + "Zone"; } Giving all of my zones id's like this 1_7Zone I've also tried removing the t: prefix from the zone parameter, this seems to make no difference. Ulrich Stärk wrote: > > Normally that happens when zone and form aren't set up correctly on the > client side, e.g. due to > inconsistent IDs. > > Did you try as Christophe suggested? Replace t:zone="${zoneId}" with > t:zone="prop:zoneId" (same for > the id parameter of zone). Does that help? > > Uli > > On 01.02.2010 12:15 schrieb lebenski: >> >> Ah! this seems to have got to the root of the problem. Request.isXHR() >> is >> returning false. I understand that this method is looking for the >> presence >> of an Http Header called X-Requested-With with the value XMLHttpRequest. >> Snooping the request I notice that this has not been set. How does this >> header get set, and what in my example could cause this not to be getting >> set? >> >> >> Ulrich Stärk wrote: >>> >>> You should @InjectComponent private Zone otherCommentsZone and return >>> otherCommentsZone.getBody() >>> from your onSuccess handler method after checking whether this is a XHR >>> request (@Inject Request and >>> do request.isXHR()). >>> >>> Uli >>> >>> On 01.02.2010 09:29 schrieb lebenski: >>>> >>>> I have a loop that contains a form and a zone. In each iteration of >>>> the >>>> loop, submission of that form should update it's relevant zone: >>>> >>>> >>>> >>> t:zone="${zoneId}"> >>>> ... >>>> >>>> >>>> >>>> >>>> ... >>>> >>>> >>>> >>>> >>>>Object onSuccessFromPickCommentForm(DraftPick draftPick) { >>>>createPickComment(draft.get(draftPick.getPackNumber(), >>>> draftPick.getPickNumber())); >>>> >>>>loadDraft(); >>>> >>>>return otherCommentsZone; >>>>} >>>> >>>> So i'm binding the zone parameter of the form to the generated client >>>> id >>>> (not the component id) as suggested in the documentation here: >>>> >>>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html >>>> >>>> After I submit the form the page refreshes rather that updating the >>>> zone. >>>> The loop runs 45 times so I end up with 45 micro forms and 45 zones on >>>> my >>>> page. Can anyone see what I'm doing wrong here? >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >>> >> > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27403412.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Form and Zone inside a loop
Normally that happens when zone and form aren't set up correctly on the client side, e.g. due to inconsistent IDs. Did you try as Christophe suggested? Replace t:zone="${zoneId}" with t:zone="prop:zoneId" (same for the id parameter of zone). Does that help? Uli On 01.02.2010 12:15 schrieb lebenski: Ah! this seems to have got to the root of the problem. Request.isXHR() is returning false. I understand that this method is looking for the presence of an Http Header called X-Requested-With with the value XMLHttpRequest. Snooping the request I notice that this has not been set. How does this header get set, and what in my example could cause this not to be getting set? Ulrich Stärk wrote: You should @InjectComponent private Zone otherCommentsZone and return otherCommentsZone.getBody() from your onSuccess handler method after checking whether this is a XHR request (@Inject Request and do request.isXHR()). Uli On 01.02.2010 09:29 schrieb lebenski: I have a loop that contains a form and a zone. In each iteration of the loop, submission of that form should update it's relevant zone: ... ... Object onSuccessFromPickCommentForm(DraftPick draftPick) { createPickComment(draft.get(draftPick.getPackNumber(), draftPick.getPickNumber())); loadDraft(); return otherCommentsZone; } So i'm binding the zone parameter of the form to the generated client id (not the component id) as suggested in the documentation here: http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html After I submit the form the page refreshes rather that updating the zone. The loop runs 45 times so I end up with 45 micro forms and 45 zones on my page. Can anyone see what I'm doing wrong here? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Form and Zone inside a loop
Ah! this seems to have got to the root of the problem. Request.isXHR() is returning false. I understand that this method is looking for the presence of an Http Header called X-Requested-With with the value XMLHttpRequest. Snooping the request I notice that this has not been set. How does this header get set, and what in my example could cause this not to be getting set? Ulrich Stärk wrote: > > You should @InjectComponent private Zone otherCommentsZone and return > otherCommentsZone.getBody() > from your onSuccess handler method after checking whether this is a XHR > request (@Inject Request and > do request.isXHR()). > > Uli > > On 01.02.2010 09:29 schrieb lebenski: >> >> I have a loop that contains a form and a zone. In each iteration of the >> loop, submission of that form should update it's relevant zone: >> >> >> > t:zone="${zoneId}"> >> ... >> >> >> >> >>... >> >> >> >> >> Object onSuccessFromPickCommentForm(DraftPick draftPick) { >> createPickComment(draft.get(draftPick.getPackNumber(), >> draftPick.getPickNumber())); >> >> loadDraft(); >> >> return otherCommentsZone; >> } >> >> So i'm binding the zone parameter of the form to the generated client id >> (not the component id) as suggested in the documentation here: >> >> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html >> >> After I submit the form the page refreshes rather that updating the zone. >> The loop runs 45 times so I end up with 45 micro forms and 45 zones on my >> page. Can anyone see what I'm doing wrong here? > > --------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27402655.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Form and Zone inside a loop
On Mon, 01 Feb 2010 06:29:14 -0200, lebenski wrote: I have a loop that contains a form and a zone. In each iteration of the loop, submission of that form should update it's relevant zone: ... ... I would create a simple component wrapping the Form and the Zone and then use it inside your loop. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Form and Zone inside a loop
You should @InjectComponent private Zone otherCommentsZone and return otherCommentsZone.getBody() from your onSuccess handler method after checking whether this is a XHR request (@Inject Request and do request.isXHR()). Uli On 01.02.2010 09:29 schrieb lebenski: I have a loop that contains a form and a zone. In each iteration of the loop, submission of that form should update it's relevant zone: ... ... Object onSuccessFromPickCommentForm(DraftPick draftPick) { createPickComment(draft.get(draftPick.getPackNumber(), draftPick.getPickNumber())); loadDraft(); return otherCommentsZone; } So i'm binding the zone parameter of the form to the generated client id (not the component id) as suggested in the documentation here: http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html After I submit the form the page refreshes rather that updating the zone. The loop runs 45 times so I end up with 45 micro forms and 45 zones on my page. Can anyone see what I'm doing wrong here? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Form and Zone inside a loop
Hi I don't know if it's the cause of your problem, but you should avoid to use ${} for parameter values, use prop: binding instead. Best Regards, Christophe Developer of wooki @wookicentral.com 2010/2/1 lebenski > > I have a loop that contains a form and a zone. In each iteration of the > loop, submission of that form should update it's relevant zone: > > > >... > > > > > ... > > > > >Object onSuccessFromPickCommentForm(DraftPick draftPick) { >createPickComment(draft.get(draftPick.getPackNumber(), > draftPick.getPickNumber())); > >loadDraft(); > >return otherCommentsZone; >} > > So i'm binding the zone parameter of the form to the generated client id > (not the component id) as suggested in the documentation here: > > > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html > > After I submit the form the page refreshes rather that updating the zone. > The loop runs 45 times so I end up with 45 micro forms and 45 zones on my > page. Can anyone see what I'm doing wrong here? > -- > View this message in context: > http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27400993.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
[T5] Form and Zone inside a loop
I have a loop that contains a form and a zone. In each iteration of the loop, submission of that form should update it's relevant zone: ... ... Object onSuccessFromPickCommentForm(DraftPick draftPick) { createPickComment(draft.get(draftPick.getPackNumber(), draftPick.getPickNumber())); loadDraft(); return otherCommentsZone; } So i'm binding the zone parameter of the form to the generated client id (not the component id) as suggested in the documentation here: http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html After I submit the form the page refreshes rather that updating the zone. The loop runs 45 times so I end up with 45 micro forms and 45 zones on my page. Can anyone see what I'm doing wrong here? -- View this message in context: http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27400993.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org