You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by hrbaer <he...@gmail.com> on 2011/04/08 23:50:38 UTC

link within modal window should reload parent page

Hi all,

at the moment I have a modal window with a link in it.
If I click the link (it's a BookmarkablePageLink) the new page get's loaded
within the modal window. But what I want to achieve is that the modal window
get's closed and the parent page get's redirected to the new page.

How can I achieve that?
Thanks in advance.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3437508.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: link within modal window should reload parent page

Posted by hrbaer <he...@gmail.com>.
MZemeck wrote:
> The only thing that comes to mind is storing a flag in session. 
That is the approach I already implemented but with the same discomfiture
you mentioned before.

Meanwhile I tried to add the embedded javascript but without any success
yet.
I added the code both to my modalpage.html and the parent page .html. Do I
have to add any information's to the link or anything else??

------------------
2. or embed javascipt to base page:

      
------------------

Thanks in advance.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3447308.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: link within modal window should reload parent page

Posted by hrbaer <he...@gmail.com>.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3447299.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: link within modal window should reload parent page

Posted by MZ...@osc.state.ny.us.
The only thing that comes to mind is storing a flag in session.  Or 
perhaps if you are updating you datastore when the link is clicked you 
could check there.  Not the best solution in my mind, if you find 
something else let me know...




From:   hrbaer <he...@gmail.com>
To:     users@wicket.apache.org
Date:   04/11/2011 05:03 PM
Subject:        Re: link within modal window should reload parent page



ok - I just realised that the WindowCloseCallback method gets triggered if 
a
user clicks on the link but also if he wants to close the popup. That's 
not
that good :(
Is there a chance to differ whether the user uses the link or just click 
on
the "x" button to close the popup?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3443126.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






Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.

Re: link within modal window should reload parent page

Posted by hrbaer <he...@gmail.com>.
ok - I just realised that the WindowCloseCallback method gets triggered if a
user clicks on the link but also if he wants to close the popup. That's not
that good :(
Is there a chance to differ whether the user uses the link or just click on
the "x" button to close the popup?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3443126.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: link within modal window should reload parent page

Posted by hrbaer <he...@gmail.com>.
It does!
I didn't expect that the "modalwindow.close( target );" triggers the
WindowClosedCallback function.

Thanks!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3443067.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: link within modal window should reload parent page

Posted by MZ...@osc.state.ny.us.
How about using setResponsePage in ModalWindow.WindowClosedCallback() or 
ModalWindow.CloseButtonCallback()?

Does modalwindow.close(target); fire CloseButtonCallback?
         




From:   hrbaer <he...@gmail.com>
To:     users@wicket.apache.org
Date:   04/11/2011 06:03 AM
Subject:        Re: link within modal window should reload parent page



Thanks for the hint but the behaviour is still present.

I added your code to both ModalPage and parent Webpage but the popup still
appears.
Any idea?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3441529.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






Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.

Re: link within modal window should reload parent page

Posted by hrbaer <he...@gmail.com>.
Thanks for the hint but the behaviour is still present.

I added your code to both ModalPage and parent Webpage but the popup still
appears.
Any idea?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3441529.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: link within modal window should reload parent page

Posted by "robert.mcguinness" <ro...@gmail.com>.
if I remember correctly:

 public void renderHead(IHeaderResponse response) {
    response.renderOnDomReadyJavascript("if (typeof Wicket != 'undefined' &&
Wicket.Window) Wicket.Window.unloadConfirmation = false;");

  }

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3440115.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: link within modal window should reload parent page

Posted by hrbaer <he...@gmail.com>.
Ok, thanks. This is working.
But if a user clicks on the link within the modal page a confirmation dialog
pops up.

http://apache-wicket.1842946.n4.nabble.com/file/n3439885/dialog.jpg 
(It's about a warning message for the user if he want's to leave the page
(because of the redirect)).

Would assume that is a functionality of the browser, isn't it?
Any chance to avoid that pop up?


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3439885.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: link within modal window should reload parent page

Posted by Martin Grigorov <mg...@apache.org>.
since you use a page for the modal you need to call "window.location" for
the parent window:
parent.location= ...the url here ...
or
top.location = ... the url here ...

On Sat, Apr 9, 2011 at 3:07 PM, hrbaer <he...@gmail.com> wrote:

> I tried to add a AjaxLink but I didn't get it so far.
> This is my code:
>
> public class ModalPage extends WebPage{
>
>    public ModalPage( final ModalWindow modalwindow ){
>
>        add( new AjaxLink( "link" ) {
>
>            public void onClick( final AjaxRequestTarget target ) {
>
>                modalwindow.close( target );
>                 target.appendJavascript("window.location='" + urlFor(
> Home.class, new PageParameters() ) + "'");
>
>            }
>
>        });
>
>    }
>
> }
>
> The current effect: The modal windows get's closed but no redirect took
> place.
> Any idea?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3438418.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
>
>


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

Re: link within modal window should reload parent page

Posted by hrbaer <he...@gmail.com>.
I tried to add a AjaxLink but I didn't get it so far.
This is my code:

public class ModalPage extends WebPage{
    
    public ModalPage( final ModalWindow modalwindow ){
        
        add( new AjaxLink( "link" ) {
            
            public void onClick( final AjaxRequestTarget target ) {
                
                modalwindow.close( target );
                target.appendJavascript("window.location='" + urlFor(
Home.class, new PageParameters() ) + "'"); 
                
            }
            
        });
        
    }

}

The current effect: The modal windows get's closed but no redirect took
place.
Any idea?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3438418.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: link within modal window should reload parent page

Posted by Alexander Morozov <al...@gmail.com>.
1. use AjaxLink

AjaxLink redirectLink = new AjaxLink(...) {
  
  public void onClick(AjaxRequestTarget target) {
    ModalWindow.closeCurrent(target);
    target.appendJavascript("window.location='" + urlFor(AnotherPage.class)
+ "'");
  } 

};

2. or embed javascipt to base page:
      



-----
--
http://www.linkedin.com/in/amorozov
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/link-within-modal-window-should-reload-parent-page-tp3437508p3438009.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