You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ned Collyer <ne...@gmail.com> on 2008/08/21 08:07:14 UTC
how to use AjaxRequestTarget in conjunction with a
FormComponent.AbstractVisitor?
I have a form that has its elements treated with various things (required
text, labels etc) - these get added by a FormComponent.AbstractVisitor in
the onBeforeRender of the form.
In the form I have a AjaxFormComponentUpdatingBehavior which adds another
panel into the form when certain conditions are met. This new panel has
form fields.
The problem is - the items in the new panel the visitor during the ajax
request.
They do when I refresh the entire page.
How can I get the form visitor to be applied to these fields during an ajax
request?
Rgds
Ned
--
View this message in context: http://www.nabble.com/how-to-use-AjaxRequestTarget-in-conjunction-with-a-FormComponent.AbstractVisitor--tp19082965p19082965.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to use AjaxRequestTarget in conjunction with a
FormComponent.AbstractVisitor?
Posted by Ned Collyer <ne...@gmail.com>.
Does anyone have any more opinions on this?
Can you share your wisdom Igor? :)
What I have at hte moment is
public class DefaultFormVisitor extends FormComponent.AbstractVisitor
implements Component.IVisitor, Serializable {
}
and I manually add this visitor in the onbeforerender of the ajax panels.
--
View this message in context: http://www.nabble.com/how-to-use-AjaxRequestTarget-in-conjunction-with-a-FormComponent.AbstractVisitor--tp19082965p19100221.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to use AjaxRequestTarget in conjunction with a FormComponent.AbstractVisitor?
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Wed, 20 Aug 2008, Ned Collyer wrote:
> eg, a dropdown for "Number of textfields" - if you choose 3, it adds 3 to
> the panel then puts it into the page with ajax.
>
> So I dont think this will work.
>
> I could perhaps wrap these added fields in their own form and nest that with
> its own visitor - just feels a bit nasty.
Hmm... I've always used repeaters for that kind of things,
they can display a dynamic amount of children. However, I'm
not sure if visiting them at that point would work either.
you might need to invoke the visitor in onBeforeRender or
something, just after the creation of the repeater items.
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to use AjaxRequestTarget in conjunction with a
FormComponent.AbstractVisitor?
Posted by Ned Collyer <ne...@gmail.com>.
Thanks for the reply - however some aspects of the panel are generated
dynamically based on the selection
eg, a dropdown for "Number of textfields" - if you choose 3, it adds 3 to
the panel then puts it into the page with ajax.
So I dont think this will work.
I could perhaps wrap these added fields in their own form and nest that with
its own visitor - just feels a bit nasty.
Timo Rantalaiho wrote:
>
> On Wed, 20 Aug 2008, Ned Collyer wrote:
>> In the form I have a AjaxFormComponentUpdatingBehavior which adds another
>> panel into the form when certain conditions are met. This new panel has
>> form fields.
>>
>> The problem is - the items in the new panel the visitor during the ajax
>> request.
>>
>> They do when I refresh the entire page.
>>
>> How can I get the form visitor to be applied to these fields during an
>> ajax
>> request?
>
> Add the new Panel always, but toggle its visibility in the
> ajax event handler. Or move the visibility logic in the
> isVisible() method of the Panel:
>
> @Override
> public boolean isVisible() {
> return certainConditionsAreMet();
> }
>
> Best wishes,
> Timo
>
> --
> Timo Rantalaiho
> Reaktor Innovations Oy <URL: http://www.ri.fi/ >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/how-to-use-AjaxRequestTarget-in-conjunction-with-a-FormComponent.AbstractVisitor--tp19082965p19083160.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to use AjaxRequestTarget in conjunction with a FormComponent.AbstractVisitor?
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Wed, 20 Aug 2008, Ned Collyer wrote:
> In the form I have a AjaxFormComponentUpdatingBehavior which adds another
> panel into the form when certain conditions are met. This new panel has
> form fields.
>
> The problem is - the items in the new panel the visitor during the ajax
> request.
>
> They do when I refresh the entire page.
>
> How can I get the form visitor to be applied to these fields during an ajax
> request?
Add the new Panel always, but toggle its visibility in the
ajax event handler. Or move the visibility logic in the
isVisible() method of the Panel:
@Override
public boolean isVisible() {
return certainConditionsAreMet();
}
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org