Repository: wicket Updated Branches: refs/heads/wicket-6.x 3b91968f8 -> a7a04e4b1
WICKET-6006 ModalWindow.closeCurrent() causes 414 status error Do not submit the form elements inside the ModalWindow when closing it. Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a7a04e4b Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a7a04e4b Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a7a04e4b Branch: refs/heads/wicket-6.x Commit: a7a04e4b17b8ca8075637879c77b173df98cacb4 Parents: 3b91968 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Sat Dec 12 23:09:15 2015 +0100 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Sat Dec 12 23:09:15 2015 +0100 ---------------------------------------------------------------------- .../ajax/markup/html/modal/ModalWindow.java | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/a7a04e4b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java ---------------------------------------------------------------------- diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java index 4831872..ed0d339 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java @@ -21,6 +21,8 @@ import org.apache.wicket.Page; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.attributes.AjaxCallListener; +import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.core.request.handler.PageProvider; import org.apache.wicket.core.request.handler.RenderPageRequestHandler; import org.apache.wicket.markup.ComponentTag; @@ -973,6 +975,16 @@ public class ModalWindow extends Panel { return super.getCallbackScript(); } + + @Override + protected void updateAjaxAttributes(AjaxRequestAttributes attributes) + { + super.updateAjaxAttributes(attributes); + AjaxCallListener listener = new AjaxCallListener(); + // disable all form elements inside the modal window to avoid serializing them in the url + listener.onBefore("$('#'+attrs.c+' :input').prop('disabled', true);"); + attributes.getAjaxCallListeners().add(listener); + } } /** @@ -1004,6 +1016,16 @@ public class ModalWindow extends Panel { return super.getCallbackScript(); } + + @Override + protected void updateAjaxAttributes(AjaxRequestAttributes attributes) + { + super.updateAjaxAttributes(attributes); + AjaxCallListener listener = new AjaxCallListener(); + // disable all form elements inside the modal window to avoid serializing them in the url + listener.onBefore("$('#'+attrs.c+' :input').prop('disabled', true);"); + attributes.getAjaxCallListeners().add(listener); + } } /**
