You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kartweel <rh...@exemail.com.au> on 2011/11/27 07:56:13 UTC
[T5.3] Need a replacement for pageDetached (or a better way to
achieving this...)
Hi,
I have the following code which I've been using to work around forms
invalidly persisting data on ajax requests (ie. form is rendered in the ajax
response, but the validation tracker stores the values for the NEXT request,
it needs to be cleared straight away). Now that pageDetached is depreciated
what would be a better way to achieve this? Or does 5.3 now handle this
correctly?
Thanks, Ryan
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-Need-a-replacement-for-pageDetached-or-a-better-way-to-achieving-this-tp5026033p5026033.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: [T5.3] Need a replacement for pageDetached (or a better way to
achieving this...)
Posted by Josh Canfield <jo...@gmail.com>.
> But I don't think afterRender will be called unless the ajax response> contains the form?
True. That seems to be what you're asking for.
> > I have the following code which I've been using to work around forms
> > invalidly persisting data on ajax requests (ie. form is rendered in
> the ajax
> > response, but the validation tracker stores the values for the NEXT
> request,
> > it needs to be cleared straight away).
Josh
On Mon, Nov 28, 2011 at 6:13 PM, Kartweel <rh...@exemail.com.au> wrote:
> Thanks,
>
> I'll give it a try.
>
> But I don't think afterRender will be called unless the ajax response
> contains the form? (ie, the form is rendered...). I think that is why I
> was using pageDetached because it is always called. What do you think?
>
> Thanks, Ryan
>
>
>
> On 29/11/2011 10:06 AM, joshcanfield [via Tapestry] wrote:
>> Hmm... somewhere between nabble and my inbox your sourcecode was
>> stripped. This seems to be a pretty common problem with nabble.
>>
>> I'm not sure that this is addressed in 5.3, or if there is a defect
>> filed yet.
>>
>> But, seems like you could use a mixin?
>>
>> // In your page/component holding the form
>> @Component(id = "form")
>> @Mixins({"AjaxFormFix"})
>> private Form form;
>>
>>
>> // In your mixins package
>>
>> @MixinAfter
>> public class AjaxFormFix {
>>
>> @Inject
>> private Request request;
>>
>> @InjectContainer
>> private Form form;
>>
>> void afterRender() {
>> if (request.isXHR()) {
>> if (form.getDefaultTracker() != null)
>> form.getDefaultTracker().clear();
>> form.setDefaultTracker(null);
>> }
>> }
>> }
>>
>> Josh
>>
>> On Sat, Nov 26, 2011 at 10:56 PM, Kartweel <[hidden email]
>> </user/SendEmail.jtp?type=node&node=5030881&i=0>> wrote:
>>
>> > Hi,
>> >
>> > I have the following code which I've been using to work around forms
>> > invalidly persisting data on ajax requests (ie. form is rendered in
>> the ajax
>> > response, but the validation tracker stores the values for the NEXT
>> request,
>> > it needs to be cleared straight away). Now that pageDetached is
>> depreciated
>> > what would be a better way to achieve this? Or does 5.3 now handle this
>> > correctly?
>> >
>> >
>> >
>> >
>> >
>> > Thanks, Ryan
>> >
>> >
>> > --
>> > View this message in context:
>> http://tapestry.1045711.n5.nabble.com/T5-3-Need-a-replacement-for-pageDetached-or-a-better-way-to-achieving-this-tp5026033p5026033.html
>> > Sent from the Tapestry - User mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]
>> </user/SendEmail.jtp?type=node&node=5030881&i=1>
>> > For additional commands, e-mail: [hidden email]
>> </user/SendEmail.jtp?type=node&node=5030881&i=2>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> </user/SendEmail.jtp?type=node&node=5030881&i=3>
>> For additional commands, e-mail: [hidden email]
>> </user/SendEmail.jtp?type=node&node=5030881&i=4>
>>
>>
>>
>> ------------------------------------------------------------------------
>> If you reply to this email, your message will be added to the
>> discussion below:
>> http://tapestry.1045711.n5.nabble.com/T5-3-Need-a-replacement-for-pageDetached-or-a-better-way-to-achieving-this-tp5026033p5030881.html
>>
>> To unsubscribe from [T5.3] Need a replacement for pageDetached (or a
>> better way to achieving this...), click here
>> <http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5026033&code=cmhvd0BleGVtYWlsLmNvbS5hdXw1MDI2MDMzfDE5MTMyMDEzNjQ=>.
>> NAML
>> <http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-Need-a-replacement-for-pageDetached-or-a-better-way-to-achieving-this-tp5026033p5030891.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: [T5.3] Need a replacement for pageDetached (or a better way to
achieving this...)
Posted by Kartweel <rh...@exemail.com.au>.
Thanks,
I'll give it a try.
But I don't think afterRender will be called unless the ajax response
contains the form? (ie, the form is rendered...). I think that is why I
was using pageDetached because it is always called. What do you think?
Thanks, Ryan
On 29/11/2011 10:06 AM, joshcanfield [via Tapestry] wrote:
> Hmm... somewhere between nabble and my inbox your sourcecode was
> stripped. This seems to be a pretty common problem with nabble.
>
> I'm not sure that this is addressed in 5.3, or if there is a defect
> filed yet.
>
> But, seems like you could use a mixin?
>
> // In your page/component holding the form
> @Component(id = "form")
> @Mixins({"AjaxFormFix"})
> private Form form;
>
>
> // In your mixins package
>
> @MixinAfter
> public class AjaxFormFix {
>
> @Inject
> private Request request;
>
> @InjectContainer
> private Form form;
>
> void afterRender() {
> if (request.isXHR()) {
> if (form.getDefaultTracker() != null)
> form.getDefaultTracker().clear();
> form.setDefaultTracker(null);
> }
> }
> }
>
> Josh
>
> On Sat, Nov 26, 2011 at 10:56 PM, Kartweel <[hidden email]
> </user/SendEmail.jtp?type=node&node=5030881&i=0>> wrote:
>
> > Hi,
> >
> > I have the following code which I've been using to work around forms
> > invalidly persisting data on ajax requests (ie. form is rendered in
> the ajax
> > response, but the validation tracker stores the values for the NEXT
> request,
> > it needs to be cleared straight away). Now that pageDetached is
> depreciated
> > what would be a better way to achieve this? Or does 5.3 now handle this
> > correctly?
> >
> >
> >
> >
> >
> > Thanks, Ryan
> >
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/T5-3-Need-a-replacement-for-pageDetached-or-a-better-way-to-achieving-this-tp5026033p5026033.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> </user/SendEmail.jtp?type=node&node=5030881&i=1>
> > For additional commands, e-mail: [hidden email]
> </user/SendEmail.jtp?type=node&node=5030881&i=2>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> </user/SendEmail.jtp?type=node&node=5030881&i=3>
> For additional commands, e-mail: [hidden email]
> </user/SendEmail.jtp?type=node&node=5030881&i=4>
>
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the
> discussion below:
> http://tapestry.1045711.n5.nabble.com/T5-3-Need-a-replacement-for-pageDetached-or-a-better-way-to-achieving-this-tp5026033p5030881.html
>
> To unsubscribe from [T5.3] Need a replacement for pageDetached (or a
> better way to achieving this...), click here
> <http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5026033&code=cmhvd0BleGVtYWlsLmNvbS5hdXw1MDI2MDMzfDE5MTMyMDEzNjQ=>.
> NAML
> <http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-Need-a-replacement-for-pageDetached-or-a-better-way-to-achieving-this-tp5026033p5030891.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
Re: [T5.3] Need a replacement for pageDetached (or a better way to
achieving this...)
Posted by Josh Canfield <jo...@gmail.com>.
Hmm... somewhere between nabble and my inbox your sourcecode was
stripped. This seems to be a pretty common problem with nabble.
I'm not sure that this is addressed in 5.3, or if there is a defect filed yet.
But, seems like you could use a mixin?
// In your page/component holding the form
@Component(id = "form")
@Mixins({"AjaxFormFix"})
private Form form;
// In your mixins package
@MixinAfter
public class AjaxFormFix {
@Inject
private Request request;
@InjectContainer
private Form form;
void afterRender() {
if (request.isXHR()) {
if (form.getDefaultTracker() != null)
form.getDefaultTracker().clear();
form.setDefaultTracker(null);
}
}
}
Josh
On Sat, Nov 26, 2011 at 10:56 PM, Kartweel <rh...@exemail.com.au> wrote:
> Hi,
>
> I have the following code which I've been using to work around forms
> invalidly persisting data on ajax requests (ie. form is rendered in the ajax
> response, but the validation tracker stores the values for the NEXT request,
> it needs to be cleared straight away). Now that pageDetached is depreciated
> what would be a better way to achieve this? Or does 5.3 now handle this
> correctly?
>
>
>
>
>
> Thanks, Ryan
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-Need-a-replacement-for-pageDetached-or-a-better-way-to-achieving-this-tp5026033p5026033.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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org