Repository: wicket
Updated Branches:
  refs/heads/wicket-7.x 6f483cf02 -> 3cefb00df


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/3cefb00d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/3cefb00d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/3cefb00d

Branch: refs/heads/wicket-7.x
Commit: 3cefb00dfa9900821a11f6af1f202af7e479138a
Parents: 6f483cf
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:11:25 2015 +0100

----------------------------------------------------------------------
 .../ajax/markup/html/modal/ModalWindow.java     | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/3cefb00d/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 48dd20f..51ec5c1 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
@@ -22,6 +22,8 @@ import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+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;
@@ -974,6 +976,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);
+               }
        }
 
        /**
@@ -1005,6 +1017,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);
+               }
        }
 
        /**

Reply via email to