SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2002
    Location
    Minneapolis, MN
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Close popped window and refresh previous?

    I have a site with a comment box that when one wants to submit a comment, it pops up a new window with a form for the comment.

    When a user submits the form it goes to a link that says "your comment has been posted, please refresh the page to view your comment".

    I'd prefer to have it submit the form, then close the window and refresh the page the popped it up (the page listing the comments)

    I've never seen this done so I don't really have any existing code to watch. Anyone have any ideas where I can start or can point me to somewhere that this setup is in use?

    Thanks-

    Justin

  2. #2
    SitePoint Addict
    Join Date
    Mar 2001
    Location
    the windy city
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. put an onSubmit event handler into your form tag:
    <form ... onSubmit="your_function()">
    2. in the js section of your page do;
    function your_function() {
    opener.document.location.reload()
    self.close()
    }

    you might also wish to fire the your_function function after a couple of seconds to make sure your form actuallt "went through" to the server. in that case do this:
    <form ... onSubmit=setTimeout("your_function", 5000)>
    in this example your function will execute 5 seconds after the user submitted the form.

    HTH
    Last edited by valeria_vi; Nov 1, 2002 at 10:05.
    Goals are dreams with deadlines
    -------------------------------------
    Nimlok Trade Show Displays Booths and Exhibits


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •