This is getting hard :-)
I don't know a way to call event.preventDefault() inside dispatchEvent().
Calling it before calling dispatchEvent() doesn't work.
Other solution would be to get reference(s) to all registered listeners and
call them manually, but again I don't know a way to do this.

On Sat, Sep 11, 2010 at 5:39 PM, Igor Vaynberg <[email protected]> wrote:

> this wont work if onsubmit handlers were added via event listeners and
> not the onsubmit attribute on the form tag.
>
> -igor
>
> On Sat, Sep 11, 2010 at 8:23 AM,  <[email protected]> wrote:
> > Author: mgrigorov
> > Date: Sat Sep 11 15:23:58 2010
> > New Revision: 996157
> >
> > URL: http://svn.apache.org/viewvc?rev=996157&view=rev
> > Log:
> > WICKET-3040 Ajax form submit fails in Wicket 1.4.11/Firefox3.6
> >
> > Do not fire form.submit() because this makes normal (non-ajax) call and
> calls just Form.onSubmit().
> > Just call form.onsubmit() if there is such and do not do anything if it
> returns negative result
> >
> >
> > Modified:
> >
>  
> wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
> >
> > Modified:
> wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
> > URL:
> http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js?rev=996157&r1=996156&r2=996157&view=diff
> >
> ==============================================================================
> > ---
> wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
> (original)
> > +++
> wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
> Sat Sep 11 15:23:58 2010
> > @@ -1093,7 +1093,10 @@ Wicket.Ajax.Call.prototype = {
> >        // Submits a form using ajax.
> >        // This method serializes a form and sends it as POST body.
> >        submitForm: function(form, submitButton) {
> > -           if (!Wicket.Event.fire(form, "submit")) return;
> > +               if (form.onsubmit) {
> > +                       if (!form.onsubmit()) return;
> > +               }
> > +
> >            if (this.handleMultipart(form, submitButton)) {
> >                return true;
> >            }
> > @@ -1103,7 +1106,7 @@ Wicket.Ajax.Call.prototype = {
> >                        s += Wicket.Form.encode(submitButton) + "=1";
> >                    }
> >                    return s;
> > -           }
> > +           }
> >            return this.request.post(body);
> >        },
> >
> >
> >
> >
>

Reply via email to