DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: close pop up page after email form submits

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Posts
    42

    close pop up page after email form submits

    I have a form on a html page which one fills in and submits using email.

    The form has been opened in a pop up page,


    Once the form has been submitted, (emailed) I need to add some javasript to say either "thank you," in the same window and then close it. Or do something else, that the user knows his form has been submitted. The pop up window that says "thank you" can have a close link on it. I do not need to refresh the parent page or refresh anything since the form is an email one.

    Any suggestions what to add where? here is the relevant part of the code below. The first part is the code of the pop up window that is used to open it

    Code:
    <a href="page.htm" onClick="NewWindow(this.href,'name','550','430','Yes');return false;">
    next is the relevant parts of the email form


    Code:
    <form action="mailto:email@website.com" method="POST" enctype="multipart/form-data" name="pledgeForm">
    Code:
      <td align="left"><input type="submit" value="Email This Form">
    </form>
    any help appreciated

  2. #2
    Join Date
    Apr 2007
    Posts
    42
    Quote Originally Posted by karen987
    I have a form on a html page which one fills in and submits using email.

    The form has been opened in a pop up page,


    Once the form has been submitted, (emailed) I need to add some javasript to say either "thank you," in the same window and then close it. Or do something else, that the user knows his form has been submitted. The pop up window that says "thank you" can have a close link on it. I do not need to refresh the parent page or refresh anything since the form is an email one.

    Any suggestions what to add where? here is the relevant part of the code below. The first part is the code of the pop up window that is used to open it

    Code:
    <a href="page.htm" onClick="NewWindow(this.href,'name','550','430','Yes');return false;">
    next is the relevant parts of the email form


    Code:
    <form action="mailto:email@website.com" method="POST" enctype="multipart/form-data" name="pledgeForm">
    Code:
      <td align="left"><input type="submit" value="Email This Form">
    </form>
    any help appreciated
    OK i changed the code a bit, but still the form is as before, the thank you message doesn't show. Any tips anyone as to what im doing wrong? Thank you.

    Code:
    <form action="mailto:email@myweb.com" method="POST" enctype="multipart/form-data" name="pledgeForm" onSubmit="document.getElementById('THANKS').style.display='block'; return true;">

    and at the bottom i have this. Just to remind, will this work on a html page or do i have to change it to an asp page?
    Code:
          <td align="left"><input type="submit" value="Email This Form"> 
    </form> 
    <DIV ID="THANKS" style="display: none;"> 
    Thank you for making this pledge. 
    <P> 
    <a href="#" onClick="window.close();">Close</a> </DIV> 
    
    </table> 
    
      </body> 
    </html>

  3. #3
    Join Date
    Apr 2007
    Posts
    42
    I tried this too a slightly different way, see the (modified code below)but didn't receive the email after i tested it. Also the thank you message appears at the bottom of the form, thus people may not even be aware its there.

    Is there any way i can make the rest of the data disappear when the "thank you" notice and "close page" thing is there?

    In the header i put
    Code:
    <script>
                function toggle_display() {
                    var form   = document.getElementById('my_form');
                    var thanks = document.getElementById('THANKS');
                    
                    form.style.display   = 'none';
                    thanks.style.display = 'block';
                }
            </script>
    at the beginning of the form i put

    Code:
    <form action="mailto:me@web.com" method="POST" enctype="multipart/form-data" id="my_form" name="pledgeForm">
    and at the bottom of the form i put

    Code:
    <input type="button" value="Email This Form" onclick="toggle_display();"/>
            </form>
            <div id="THANKS" style="display:none;">
                Thank you for making this pledge. 
                <a href="#" onclick="window.close();">Close</a>
            </div>
        </body>
    </html>
    Does anyone what i need to change/add/modify to make this work? I need to submit the form, then the thank you message preferably without the rest of the data.

    THank you for your patience and time, and to anyone else who may have something to add here.

  4. #4
    Join Date
    Jul 2007
    Posts
    3
    You're nearly there - try this out in your opener page:

    <form action="mailto:email@myweb.com" method="POST" enctype="multipart/form-data" name="pledgeForm">
    <div id="FormData">
    form data here!<br>
    <input type="submit" value="Email This Form" onclick="document.getElementById('FormData').style.display='none';document.getElementById( 'THANKS').style.display=''">
    </div>

    </form>
    <DIV ID="THANKS" style="display: none;">
    Thank you for making this pledge.
    <P>
    <a href="#" onClick="window.close();">Close</a> </DIV>

    </table>

    </body>
    </html>

Similar Threads

  1. Form Post from mfc dll to aspx page
    By mmingfeilam in forum C++
    Replies: 0
    Last Post: 07-04-2006, 09:26 AM
  2. Replies: 0
    Last Post: 11-02-2001, 03:04 AM
  3. email results of a form
    By G in forum Web
    Replies: 0
    Last Post: 04-06-2001, 09:59 AM
  4. Replies: 0
    Last Post: 01-22-2001, 04:59 PM
  5. Disable Form Close Button
    By Ivo in forum VB Classic
    Replies: 0
    Last Post: 08-31-2000, 08:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center