You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2017/05/08 19:18:37 UTC

Modal failing to modify it's parent in ajax event

I have a wicket modal.  On clicking a button in it, that is part of the form
in the modal's page, I need to close the modal, put a message in the
feedback of the parent page, and invoke a javascript method in the parent
page.  I am using the pagecreator approach to ModalWindow.  This is Wicket
6.26.

The problem is that when i go to hit the button, I am getting the following
javascipt error:

Wicket.Ajax:  TypeError: Unable to get property 'top' of undefined or null
reference

It then has two cascaded errors that imply that it is trying to work the DOM
inside the iframe instead of the parent window.  Which makes sense, but I am
almost certain that I've done this sort of thing before (but can't find an
example).  I don't think I'm doing anything especially different.  

I am wondering if I need to run the ModalWindow.closeCurrent() first, and
then after it closes, respond to the event from that to do the feedback and
javascript call?  That chaining seems awkward, so I figured I'd ask before I
tried it.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-event-tp4677800.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Modal failing to modify it's parent in ajax event

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, May 9, 2017 at 3:11 PM, Entropy <bl...@gmail.com> wrote:

> That would explain the javascript part.  How would I get Wicket to do that
> to manipulate the feedback panel?  Or would I be better off rewriting using
>

I see no way how to do this.
Wicket can detect that a Component that is added to the AjaxRequestTarget
is not a child of the page that has been used to create this
AjaxRequestTarget.
But I don't see how Wicket can safely assume that the second page is
reachable via 'parent' or 'top'.


> the pnale style instead of the iframe style (which I am starting to lean
> towards).
>

Yes, this is the recommended way!


>
>
> Brian Mulholland
> "For every complex problem, there is an answer that is clear, simple and
> wrong."
> --H.L. Mencken
> "Politics is the art of looking for trouble, finding it everywhere,
> diagnosing it incorrectly, and applying the wrong remedies."
> --Groucho Marx
>
> On Mon, May 8, 2017 at 3:26 PM, Martin Grigorov-4 [via Apache Wicket] <
> ml+s1842946n4677801h95@n4.nabble.com> wrote:
>
> > Hi,
> >
> > Since you use PageCreator then your modal page is loaded inside an iframe
> > and all your findings are valid!
> > You need to use JavaScript 'parent' or 'top' window references to
> > manipulate the DOM of the page in the browser tab.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, May 8, 2017 at 9:18 PM, Entropy <[hidden email]
> > <http:///user/SendEmail.jtp?type=node&node=4677801&i=0>> wrote:
> >
> > > I have a wicket modal.  On clicking a button in it, that is part of the
> > > form
> > > in the modal's page, I need to close the modal, put a message in the
> > > feedback of the parent page, and invoke a javascript method in the
> > parent
> > > page.  I am using the pagecreator approach to ModalWindow.  This is
> > Wicket
> > > 6.26.
> > >
> > > The problem is that when i go to hit the button, I am getting the
> > following
> > > javascipt error:
> > >
> > > Wicket.Ajax:  TypeError: Unable to get property 'top' of undefined or
> > null
> > > reference
> > >
> > > It then has two cascaded errors that imply that it is trying to work
> the
> > > DOM
> > > inside the iframe instead of the parent window.  Which makes sense, but
> > I
> > > am
> > > almost certain that I've done this sort of thing before (but can't find
> > an
> > > example).  I don't think I'm doing anything especially different.
> > >
> > > I am wondering if I need to run the ModalWindow.closeCurrent() first,
> > and
> > > then after it closes, respond to the event from that to do the feedback
> > and
> > > javascript call?  That chaining seems awkward, so I figured I'd ask
> > before
> > > I
> > > tried it.
> > >
> > > --
> > > View this message in context: http://apache-wicket.1842946.
> > > n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-
> > > event-tp4677800.html
> > > Sent from the Users forum mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > <http:///user/SendEmail.jtp?type=node&node=4677801&i=1>
> > > For additional commands, e-mail: [hidden email]
> > <http:///user/SendEmail.jtp?type=node&node=4677801&i=2>
> > >
> > >
> >
> >
> > ------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> > http://apache-wicket.1842946.n4.nabble.com/Modal-failing-
> > to-modify-it-s-parent-in-ajax-event-tp4677800p4677801.html
> > To unsubscribe from Modal failing to modify it's parent in ajax event,
> click
> > here
> > <http://apache-wicket.1842946.n4.nabble.com/template/
> NamlServlet.jtp?macro=unsubscribe_by_code&node=4677800&code=
> YmxtdWxob2xsYW5kQGdtYWlsLmNvbXw0Njc3ODAwfC05NzMyODEwMzU=>
> > .
> > NAML
> > <http://apache-wicket.1842946.n4.nabble.com/template/
> NamlServlet.jtp?macro=macro_viewer&id=instant_html%
> 21nabble%3Aemail.naml&base=nabble.naml.namespaces.
> BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.view.web.template.NodeNamespace&breadcrumbs=
> notify_subscribers%21nabble%3Aemail.naml-instant_emails%
> 21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> >
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-
> event-tp4677800p4677811.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Modal failing to modify it's parent in ajax event

Posted by Entropy <bl...@gmail.com>.
That would explain the javascript part.  How would I get Wicket to do that
to manipulate the feedback panel?  Or would I be better off rewriting using
the pnale style instead of the iframe style (which I am starting to lean
towards).


Brian Mulholland
"For every complex problem, there is an answer that is clear, simple and
wrong."
--H.L. Mencken
"Politics is the art of looking for trouble, finding it everywhere,
diagnosing it incorrectly, and applying the wrong remedies."
--Groucho Marx

On Mon, May 8, 2017 at 3:26 PM, Martin Grigorov-4 [via Apache Wicket] <
ml+s1842946n4677801h95@n4.nabble.com> wrote:

> Hi,
>
> Since you use PageCreator then your modal page is loaded inside an iframe
> and all your findings are valid!
> You need to use JavaScript 'parent' or 'top' window references to
> manipulate the DOM of the page in the browser tab.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, May 8, 2017 at 9:18 PM, Entropy <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4677801&i=0>> wrote:
>
> > I have a wicket modal.  On clicking a button in it, that is part of the
> > form
> > in the modal's page, I need to close the modal, put a message in the
> > feedback of the parent page, and invoke a javascript method in the
> parent
> > page.  I am using the pagecreator approach to ModalWindow.  This is
> Wicket
> > 6.26.
> >
> > The problem is that when i go to hit the button, I am getting the
> following
> > javascipt error:
> >
> > Wicket.Ajax:  TypeError: Unable to get property 'top' of undefined or
> null
> > reference
> >
> > It then has two cascaded errors that imply that it is trying to work the
> > DOM
> > inside the iframe instead of the parent window.  Which makes sense, but
> I
> > am
> > almost certain that I've done this sort of thing before (but can't find
> an
> > example).  I don't think I'm doing anything especially different.
> >
> > I am wondering if I need to run the ModalWindow.closeCurrent() first,
> and
> > then after it closes, respond to the event from that to do the feedback
> and
> > javascript call?  That chaining seems awkward, so I figured I'd ask
> before
> > I
> > tried it.
> >
> > --
> > View this message in context: http://apache-wicket.1842946.
> > n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-
> > event-tp4677800.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4677801&i=1>
> > For additional commands, e-mail: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4677801&i=2>
> >
> >
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-wicket.1842946.n4.nabble.com/Modal-failing-
> to-modify-it-s-parent-in-ajax-event-tp4677800p4677801.html
> To unsubscribe from Modal failing to modify it's parent in ajax event, click
> here
> <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4677800&code=YmxtdWxob2xsYW5kQGdtYWlsLmNvbXw0Njc3ODAwfC05NzMyODEwMzU=>
> .
> NAML
> <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-event-tp4677800p4677811.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Modal failing to modify it's parent in ajax event

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Since you use PageCreator then your modal page is loaded inside an iframe
and all your findings are valid!
You need to use JavaScript 'parent' or 'top' window references to
manipulate the DOM of the page in the browser tab.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, May 8, 2017 at 9:18 PM, Entropy <bl...@gmail.com> wrote:

> I have a wicket modal.  On clicking a button in it, that is part of the
> form
> in the modal's page, I need to close the modal, put a message in the
> feedback of the parent page, and invoke a javascript method in the parent
> page.  I am using the pagecreator approach to ModalWindow.  This is Wicket
> 6.26.
>
> The problem is that when i go to hit the button, I am getting the following
> javascipt error:
>
> Wicket.Ajax:  TypeError: Unable to get property 'top' of undefined or null
> reference
>
> It then has two cascaded errors that imply that it is trying to work the
> DOM
> inside the iframe instead of the parent window.  Which makes sense, but I
> am
> almost certain that I've done this sort of thing before (but can't find an
> example).  I don't think I'm doing anything especially different.
>
> I am wondering if I need to run the ModalWindow.closeCurrent() first, and
> then after it closes, respond to the event from that to do the feedback and
> javascript call?  That chaining seems awkward, so I figured I'd ask before
> I
> tried it.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-
> event-tp4677800.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>