You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by guydog28 <gr...@guydo.com> on 2010/12/14 05:06:44 UTC

How to listen for CHILD ajax form submits

I have a panel.  I cannot figure out a way to have this panel informed if any
of its children happens to exectute an AjaxFormSubmittingBehavior form
submit.  Ideally, I'd like my panel to listen for this, and have access to
the AjaxRequestTarget.  Is there a reasonable way to do this?  My panel does
not define the child hierarchy, or where/if there is a form that will be
submitted via ajax from within panel.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-listen-for-CHILD-ajax-form-submits-tp3086439p3086439.html
Sent from the Users forum 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 listen for CHILD ajax form submits

Posted by guydog28 <gr...@guydo.com>.
Ernesto,

I had thought of that.  I was hoping to avoid the custom button/link route,
but seeing as I haven't heard anything more elegant yet, I decided to go
with it for now.  Thanks for your input!
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-listen-for-CHILD-ajax-form-submits-tp3086439p3092111.html
Sent from the Users forum 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 listen for CHILD ajax form submits

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
If you have full control over the contents of your dialog you could try to

1- create the interface to mark your dialog:

public interface IAjaxSubmitAware {
	
	void onSubmit(AjaxRequestTarget target);
}

2- create your own link, buttons, etc as in

public abstract class MyAjaxSubmitLink extends AjaxSubmitLink {

	private static final long serialVersionUID = 1L;

	/**
	 * @param id
	 */
	public MyAjaxSubmitLink(String id) {
		super(id);
	}

	/**
	 * @param id
	 * @param form
	 */
	public MyAjaxSubmitLink(String id, Form<?> form) {
		super(id, form);
	}

	@Override
	protected final void onSubmit(AjaxRequestTarget target, Form<?> form) {
		IAjaxSubmitAware submitAware = findParent(IAjaxSubmitAware.class);
		if(submitAware != null) {
			submitAware.onSubmit(target);
		}
		doOnSubmit(target, form);
	}

	protected abstract void  doOnSubmit(AjaxRequestTarget target, Form<?> form);
}

Ernesto


On Tue, Dec 14, 2010 at 9:16 PM, guydog28 <gr...@guydo.com> wrote:
>
> Anyone?  Abstract:  I have extended WiQuery Dialog with our own custom
> dialog.  I want the MyDialog to know if any child components are a Form,
> being submitted via AJAX (AjaxFormSubmitBehavior).  I need access to the
> AjaxRequestTarget created by that ajax form submit so I can append
> javascript to it or add components.  I'm really hoping someone has a
> suggestion that I missed.  This is a major blocker for us right now.
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-listen-for-CHILD-ajax-form-submits-tp3086439p3087882.html
> Sent from the Users forum 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
>
>

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


Re: How to listen for CHILD ajax form submits

Posted by Martin Grigorov <mg...@apache.org>.
if you use 1.5 then you can use the new event mechanism. see WICKET-1312

in 1.4 you can use something like:

new AjaxFormSubmitBehavior("event) {

   onSubmit(AjaxRequestTarget target, Form form) {
     ...
    target.addChildren(getPage(), MyDialog.class);
  }
}

The last line will register all instances of type MyDialog to be re-rendered
in this Ajax request/response.
Then in your MyDialog#onBeforeRender() { target = AjaxRequestTarget.get();
doSomethingWithTarget(target); }

On Tue, Dec 14, 2010 at 9:16 PM, guydog28 <gr...@guydo.com> wrote:

>
> Anyone?  Abstract:  I have extended WiQuery Dialog with our own custom
> dialog.  I want the MyDialog to know if any child components are a Form,
> being submitted via AJAX (AjaxFormSubmitBehavior).  I need access to the
> AjaxRequestTarget created by that ajax form submit so I can append
> javascript to it or add components.  I'm really hoping someone has a
> suggestion that I missed.  This is a major blocker for us right now.
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-listen-for-CHILD-ajax-form-submits-tp3086439p3087882.html
> Sent from the Users forum 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 listen for CHILD ajax form submits

Posted by guydog28 <gr...@guydo.com>.
Anyone?  Abstract:  I have extended WiQuery Dialog with our own custom
dialog.  I want the MyDialog to know if any child components are a Form,
being submitted via AJAX (AjaxFormSubmitBehavior).  I need access to the
AjaxRequestTarget created by that ajax form submit so I can append
javascript to it or add components.  I'm really hoping someone has a
suggestion that I missed.  This is a major blocker for us right now.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-listen-for-CHILD-ajax-form-submits-tp3086439p3087882.html
Sent from the Users forum 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