You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Frank van Lankvelt <f....@onehippo.com> on 2011/03/03 12:59:51 UTC

ajax form submit invoked with scope window

debugging a problem with an external javascript library that's used in our
project, I'm seeing an onclick handler on a form button being invoked with
scope window.
I wasn't aware that this was legal and cannot see how the library is causing
this, but it did point me to the AjaxFormSubmitBehavior precondition script.

In there, it says on line 182 (wicket-1.4.x):

src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
@@ -179,6 +179,6 @@
  @Override
  protected CharSequence getPreconditionScript()
  {
return "return Wicket.$$(this)&&Wicket.$$('" + getForm().getMarkupId() +
"')";
  }
 }

This appears to be the only place where $$(this) is used.  Removing the
check fixes my original problem, but it must be there for a reason.  Does
anyone know why?
(it was added at r574685 by Matej Knopp)

I'll continue trying to create a quickstart for the issue, that should help
discussing it ;-)

thanks, Frank


-- 
Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31 (0)20
522 4466
USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA. 94954
•  +1 877 414 4776 (toll free)
Canada    •   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC H2T
1S5  •  +1 (514) 316 8966
www.onehippo.com  •  www.onehippo.org  •  info@onehippo.com
________________________________________________________________
This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.

Re: ajax form submit invoked with scope window

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Mar 14, 2011 at 2:55 PM, Frank van Lankvelt <
f.vanlankvelt@onehippo.com> wrote:

> got 'round to investigating the problem in more detail.  The code in the
> AbstractDefaultAjaxBehavior previously failed to bind the function that
> executes the precondition to the event scope.  This caused the precondition
> to be invoked with window scope.
>
> Good news: It does no longer occur since 1.4.16, thanks to the fix for
> WICKET-3321.
>
> thanks for listening, Frank
>
welcome ;-)

>
>
> On Thu, Mar 3, 2011 at 12:59 PM, Frank van Lankvelt <
> f.vanlankvelt@onehippo.com> wrote:
>
> > debugging a problem with an external javascript library that's used in
> our
> > project, I'm seeing an onclick handler on a form button being invoked
> with
> > scope window.
> > I wasn't aware that this was legal and cannot see how the library is
> > causing this, but it did point me to the AjaxFormSubmitBehavior
> precondition
> > script.
> >
> > In there, it says on line 182 (wicket-1.4.x):
> >
> > src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
> > @@ -179,6 +179,6 @@
> >   @Override
> >   protected CharSequence getPreconditionScript()
> >   {
> > return "return Wicket.$$(this)&&Wicket.$$('" + getForm().getMarkupId() +
> > "')";
> >   }
> >  }
> >
> > This appears to be the only place where $$(this) is used.  Removing the
> > check fixes my original problem, but it must be there for a reason.  Does
> > anyone know why?
> > (it was added at r574685 by Matej Knopp)
> >
> > I'll continue trying to create a quickstart for the issue, that should
> help
> > discussing it ;-)
> >
> > thanks, Frank
> >
> >
> > --
> > Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31
> > (0)20 522 4466
> > USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA.
> 94954
> > •  +1 877 414 4776 (toll free)
> > Canada    •   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC H2T
> > 1S5  •  +1 (514) 316 8966
> > www.onehippo.com  •  www.onehippo.org  •  info@onehippo.com
> > ________________________________________________________________
> > This e-mail may be privileged and/or confidential, and the sender does
> > not waive any related rights and obligations. Any distribution, use or
> > copying of this e-mail or the information it contains by other than an
> > intended recipient is unauthorized. If you received this e-mail in
> > error, please advise me (by return e-mail or otherwise) immediately.
> >
>
>
>
> --
> Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31
> (0)20
> 522 4466
> USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA. 94954
> •  +1 877 414 4776 (toll free)
> Canada    •   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC H2T
> 1S5  •  +1 (514) 316 8966
> www.onehippo.com  •  www.onehippo.org  •  info@onehippo.com
> ________________________________________________________________
> This e-mail may be privileged and/or confidential, and the sender does
> not waive any related rights and obligations. Any distribution, use or
> copying of this e-mail or the information it contains by other than an
> intended recipient is unauthorized. If you received this e-mail in
> error, please advise me (by return e-mail or otherwise) immediately.
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: ajax form submit invoked with scope window

Posted by Frank van Lankvelt <f....@onehippo.com>.
got 'round to investigating the problem in more detail.  The code in the
AbstractDefaultAjaxBehavior previously failed to bind the function that
executes the precondition to the event scope.  This caused the precondition
to be invoked with window scope.

Good news: It does no longer occur since 1.4.16, thanks to the fix for
WICKET-3321.

thanks for listening, Frank


On Thu, Mar 3, 2011 at 12:59 PM, Frank van Lankvelt <
f.vanlankvelt@onehippo.com> wrote:

> debugging a problem with an external javascript library that's used in our
> project, I'm seeing an onclick handler on a form button being invoked with
> scope window.
> I wasn't aware that this was legal and cannot see how the library is
> causing this, but it did point me to the AjaxFormSubmitBehavior precondition
> script.
>
> In there, it says on line 182 (wicket-1.4.x):
>
> src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
> @@ -179,6 +179,6 @@
>   @Override
>   protected CharSequence getPreconditionScript()
>   {
> return "return Wicket.$$(this)&&Wicket.$$('" + getForm().getMarkupId() +
> "')";
>   }
>  }
>
> This appears to be the only place where $$(this) is used.  Removing the
> check fixes my original problem, but it must be there for a reason.  Does
> anyone know why?
> (it was added at r574685 by Matej Knopp)
>
> I'll continue trying to create a quickstart for the issue, that should help
> discussing it ;-)
>
> thanks, Frank
>
>
> --
> Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31
> (0)20 522 4466
> USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA. 94954
> •  +1 877 414 4776 (toll free)
> Canada    •   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC H2T
> 1S5  •  +1 (514) 316 8966
> www.onehippo.com  •  www.onehippo.org  •  info@onehippo.com
> ________________________________________________________________
> This e-mail may be privileged and/or confidential, and the sender does
> not waive any related rights and obligations. Any distribution, use or
> copying of this e-mail or the information it contains by other than an
> intended recipient is unauthorized. If you received this e-mail in
> error, please advise me (by return e-mail or otherwise) immediately.
>



-- 
Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31 (0)20
522 4466
USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA. 94954
•  +1 877 414 4776 (toll free)
Canada    •   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC H2T
1S5  •  +1 (514) 316 8966
www.onehippo.com  •  www.onehippo.org  •  info@onehippo.com
________________________________________________________________
This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.