[ 
https://issues.apache.org/jira/browse/WICKET-1448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582213#action_12582213
 ] 

xiefei commented on WICKET-1448:
--------------------------------

Here is a simple patch, it has passed a brief test on IE6, Opera 9.23, Firefox 
2.0, nested form not considered. 

Index: SubmitLink.java
===================================================================
--- SubmitLink.java     (revision 641220)
+++ SubmitLink.java     (working copy)
@@ -211,10 +211,10 @@
                                {
                                        sb.append("var ff=f;");
                                }
-                               sb
-                                               .append("if (ff.onsubmit != 
undefined) { if (ff.onsubmit()==false) return false; }");
                        }
-                       sb.append("f.submit();e.value='';e.name='';return 
false;");
+                       
sb.append("if(f.fireEvent){if(f.fireEvent('onsubmit'))f.submit();} ")
+            .append("else {var e = document.createEvent('Event'); 
e.initEvent('submit', true, true); f.dispatchEvent(e);}")
+            .append("e.value='';e.name='';return false;");
                        return sb.toString();
                }
                else


> SubmitLink bypass jquery submit eventhandler
> --------------------------------------------
>
>                 Key: WICKET-1448
>                 URL: https://issues.apache.org/jira/browse/WICKET-1448
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.2
>            Reporter: xiefei
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.3
>
>
> <form id="wicketForm"><a href="#" wicket:id="submitLink">submit</a></form>
> if:
>         
> response.renderOnDomReadyJavascript("jQuery('#"+component.getMarkupId()+"').submit(function(){alert('x');return
>  false;})");
> the alert will not show when submitLink is clicked, and the form is submitted
> if: 
>         
> response.renderOnDomReadyJavascript("document.getElementById('"+component.getMarkupId()+"').onsubmit
>  = function(){alert('x');return false;}");
> the alert will show and the form is not submmitted

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to