On Thu, May 12, 2011 at 7:32 PM, <[email protected]> wrote:
> Author: pete
> Date: Thu May 12 17:32:38 2011
> New Revision: 1102395
>
> URL: http://svn.apache.org/viewvc?rev=1102395&view=rev
> Log:
> WICKET-3705 AjaxSubmit in modal window doesn't call form.onSubmit() before
> ending request
>
> Modified:
>
>
> wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
>
> Modified:
> wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
> URL:
> http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java?rev=1102395&r1=1102394&r2=1102395&view=diff
>
> ==============================================================================
> ---
> wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
> (original)
> +++
> wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
> Thu May 12 17:32:38 2011
> @@ -1131,23 +1131,37 @@ public class Form<T> extends WebMarkupCo
> */
> protected void delegateSubmit(IFormSubmitter submittingComponent)
> {
> - // when the given submitting component is not null, it
> means that it was the
> - // submitting component
> + final Form<?> processingForm;
> +
> + // process submitting component (if specified)
> if (submittingComponent != null)
> {
> - // use the form which the submittingComponent has
> submitted for further processing
> + // use form of submitting component for processing
> + processingForm = submittingComponent.getForm();
> +
> + if(processingForm == null)
> + {
> + throw new IllegalStateException("submitting
> component must not return 'null' on getForm()");
> + }
> +
> + // invoke submit on component
> submittingComponent.onSubmit();
> }
> -
> - // Model was successfully updated with valid data
> -
> - Visits.visitPostOrder(this, new IVisitor<Form<?>, Void>()
> + else
> + {
> + processingForm = this;
> + }
> +
> + // invoke submit on top-level form
> + processingForm.onSubmit();
> +
> + // process active child forms
> + Visits.visitChildren(processingForm, new IVisitor<Form<?>,
> Void>()
>
>From .visitPostOrder() to .visitChildren() - is that intentional ?
> {
> public void component(Form<?> form, IVisit<Void>
> visit)
> {
> if (form.isEnabledInHierarchy() &&
> form.isVisibleInHierarchy())
> {
> -
> form.onSubmit();
> }
> }
>
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>