onclick question

Discussion in 'PHP' started by schlogo, May 17, 2009.

  1. #1
    Hello

    Here s my question of the day, I am opening a contact form using modal box of mootools. That works fine, now, when the user clicks "send", i can get it to close the box


    <input value="send" type="submit" onclick="window.parent.document.getElementById('sbox-window').close(); "/>
    PHP:
    Now the problem is, how can i , on click, close the box and redirect the parent page to a "tks for your email page ".


    I ve tried many things but it always do the redirection in the lightbox and it does not close the window anymore

    Any help is very welcome
     
    schlogo, May 17, 2009 IP
  2. catgnome

    catgnome Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    window.opener.location.href = 'http://www.amazon.com';
    
    PHP:
     
    catgnome, May 17, 2009 IP
  3. schlogo

    schlogo Well-Known Member

    Messages:
    1,615
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    140
    #3
    hello

    where would you insert it in the code of the first post, so that it closes the lightbox and forward the user to amazon?
     
    schlogo, May 17, 2009 IP
  4. catgnome

    catgnome Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You have a popup ( or simply a new window, opened by another window ) and you close it by pressing Close button, right ? Now, instead of using your current onClick event, create a JS function, containing your current onClick + the one I pasted earlier ( Close event should be AFTER redirect ).

    <script type="text/javascript">
    function CloseRedirect() {
    	window.opener.location.href = 'http://www.amazon.com';	// Redirect
    	window.parent.document.getElementById('sbox-window').close();	// Close
    }
    </script>
    
    <input value="send" type="submit" onclick="CloseRedirect()"/>
    PHP:
     
    catgnome, May 17, 2009 IP
  5. schlogo

    schlogo Well-Known Member

    Messages:
    1,615
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Just tried, i ve tested only the close function in the js, it works, then i ve tried with the full thing, it does not work, it does not redirect and it does not close the lightbox :-/
     
    schlogo, May 17, 2009 IP
  6. schlogo

    schlogo Well-Known Member

    Messages:
    1,615
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    140
    #6
    it actually tries to redirect but inside the lightbox
     
    schlogo, May 17, 2009 IP
  7. catgnome

    catgnome Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    How do you open your "lightbox" ( via JavaScript or _blank ) ?
     
    catgnome, May 17, 2009 IP
  8. schlogo

    schlogo Well-Known Member

    Messages:
    1,615
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    140
    #8
    javascript
     
    schlogo, May 17, 2009 IP
  9. schlogo

    schlogo Well-Known Member

    Messages:
    1,615
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    140
    #9
    finally got the right answer from chronoengine forum

    onclick="window.parent.document.location = 'new url here'"
    PHP:
    it works

    tks :D
     
    schlogo, May 19, 2009 IP