Refresh or close after form submission

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmorand
    New Member
    • Sep 2007
    • 219

    Refresh or close after form submission

    I have a page that I want to be refreshed after a user submits a form. I also have another page that I want to be closed after a user submits a form.

    How would I go about doing this??
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    could you explain that a bit more? what do you mean with closing a page - do you mean closing a window that displays a page? when you submit what happens then - do you call a php script that you control?

    kind regards

    Comment

    • dmorand
      New Member
      • Sep 2007
      • 219

      #3
      I have a popup form that's used to submit comments. When the user clicks the submit button, I'd like the popup window to close once the submission takes place.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        just call a js-function onsubmit of your form that uses window.close()

        kind regards

        Comment

        • dmorand
          New Member
          • Sep 2007
          • 219

          #5
          Originally posted by gits
          just call a js-function onsubmit of your form that uses window.close()

          kind regards
          Excellent, I'll give that a try

          Comment

          • dmorand
            New Member
            • Sep 2007
            • 219

            #6
            How come if I try to do this:

            onSubmit="windo w.location.relo ad();" in my form tag it's not submitting the form, it's just refreshing the screen. I want the screen to refresh after the form gets submitted to allow the user to enter a new form without having to jump between screens.

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              onsubmit is called as soon as the submit button is pressed, not after the submit takes place. Add the refresh to the submitted page instead.

              Comment

              • htmlnoob112233
                New Member
                • Jun 2009
                • 20

                #8
                I have the same problem as I want to make the submit button refresh.

                I have 3 frames on my page and need the page to refresh after a submit button is pressed for its changes to take effect (change style sheet)

                However using


                <input type="submit" onSubmit="windo w.location.relo ad();" value="Go">just submits and does not refresh.

                I am using the http://php.about.com/od/finishedphp1...s_switcher.htm script.

                Does anyone know how to make the button refresh the page as well?

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  onsubmit is a form event, not an input button event. In any case, that wouldn't work either. I assume the form is in a frame and the form submits to the same frame. What you'd need to do is refresh the whole page after the page has been submitted.

                  Comment

                  • htmlnoob112233
                    New Member
                    • Jun 2009
                    • 20

                    #10
                    Yes, I don't want my visitors to have to manualy do that.

                    I was thinking of putting js into my cookie.php which is what the form is linked to.
                    But don't know what to add?

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #11
                      You'd need to reference the parent using 'parent' or 'top' and then reload. It is possible to change styles without reloading the page. One other thing: if possible, try to avoid frames.

                      Comment

                      • htmlnoob112233
                        New Member
                        • Jun 2009
                        • 20

                        #12
                        I tried targeting it with _Parent but it just loaded the same frame in the frame that was suppost to refresh.

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          #13
                          Do you only want to reload one frame or the page which contains the 3 frames?

                          Comment

                          • htmlnoob112233
                            New Member
                            • Jun 2009
                            • 20

                            #14
                            just 1 other frame would do, but either. If its possible to reload the whole page then i'd prefer that.

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              #15
                              To access the parent (the page containing the frames) and reload it:
                              Code:
                              parent.location.reload();
                              You would call this after page load in one of the frames. Is there any particular reason why you're using frames?

                              Comment

                              Working...