You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Igor Vaynberg <iv...@apache.org> on 2010/09/11 17:39:54 UTC
Re: svn commit: r996157 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
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, <mg...@apache.org> 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);
> },
>
>
>
>
Re: svn commit: r996157 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
Posted by Igor Vaynberg <ig...@gmail.com>.
i will figure something out..
-igor
On Sat, Sep 11, 2010 at 9:09 AM, Martin Grigorov <mg...@apache.org> wrote:
> 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 <iv...@apache.org> 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, <mg...@apache.org> 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);
>> > },
>> >
>> >
>> >
>> >
>>
>
Re: svn commit: r996157 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
Posted by Martin Grigorov <mg...@apache.org>.
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 <iv...@apache.org> 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, <mg...@apache.org> 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);
> > },
> >
> >
> >
> >
>