473,785 Members | 2,297 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to close pop up page after email form has been submitted

114 New Member
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

Expand|Select|Wrap|Line Numbers
  1. <a href="page.htm" onClick="NewWindow(this.href,'name','550','430','Yes');return false;">
next is the relevant parts of the email form


Expand|Select|Wrap|Line Numbers
  1. <form action="mailto:email@website.com" method="POST" enctype="multipart/form-data" name="pledgeForm">
  2.  
  3.  
  4.   <td align="left"><input type="submit" value="Email This Form">
  5. </form>
thanks for any help
Jul 1 '07
23 3244
gits
5,390 Recognized Expert Moderator Expert
the line:

Expand|Select|Wrap|Line Numbers
  1. form.style.display = 'none';
should do the job ... and it works here. is the sample working allone? use a new html-file and paste the sample to it ... load it to the browser and tell me what happens ... ok?

kind regards ...
Jul 2 '07 #11
karen987
114 New Member
the line:

Expand|Select|Wrap|Line Numbers
  1. form.style.display = 'none';
should do the job ... and it works here. is the sample working allone? use a new html-file and paste the sample to it ... load it to the browser and tell me what happens ... ok?

kind regards ...
i already have that in the javascript function which i put in the top of the page. here it is. is it in the right way or maybe i should move it?

Expand|Select|Wrap|Line Numbers
  1. <script> 
  2.             function toggle_display() { 
  3.                 var form   = document.getElementById('my_form'); 
  4.                 var thanks = document.getElementById('THANKS'); 
  5.  
  6.                 form.style.display   = 'none'; 
  7.                 thanks.style.display = 'block'; 
  8.             } 
  9.         </script> 
I tried the form again, it works fine , except that the form displays after i click submit.
I put this at the top of the page, not in the header file
Jul 2 '07 #12
karen987
114 New Member
here is the exact code of the top and bottom of the page

Expand|Select|Wrap|Line Numbers
  1. <html><head>
  2.     <title>title </title>
  3.     <link rel="STYLESHEET" type="text/css" href="styles.css">
  4.         <STYLE TYPE="text/css">
  5. <!--
  6. body {scrollbar-base-color: #4169E1}
  7. -->
  8.         </STYLE>
  9.  
  10.  
  11.      <script>
  12.             function toggle_display() {
  13.                 var form   = document.getElementById('my_form');
  14.                 var thanks = document.getElementById('THANKS');
  15.                 form.style.display   = 'none';
  16.                 thanks.style.display = 'block';
  17.             }
  18.         </script>
  19.  
  20.     </head>
  21.  
  22.     <body>
  23.  
  24. <table width="538" align="center">
  25.  
  26.  
  27. <form action="mailto:me@iweb.com" method="POST" enctype="multipart/form-data" id="my_form" name="pledgeForm">
  28.      <div id="THANKS" style="display:none;">
  29.             Thank you for making this pledge. 
  30.             <a href="#" onClick="window.close();">Close</a>
  31.         </div>
and the bottom part
Expand|Select|Wrap|Line Numbers
  1. <td align="left"><input type="submit" value="Email This Form" onClick="toggle_display();"/></td>
  2.         </form>
  3.  
  4.     </body>
  5. </html>
Jul 2 '07 #13
gits
5,390 Recognized Expert Moderator Expert
at first the the thanks-div should be outside of the form-tag ...
Jul 2 '07 #14
karen987
114 New Member
ok iput it outside the form tag. It doesn't work at the top of the page, but it does at the bottom after the end of the form.

The only problem now is how to get rid of the form text when the "thank you" shows?

thanks
Jul 2 '07 #15
gits
5,390 Recognized Expert Moderator Expert
... yes of course ... all nodes that should be displayed by the browser has to be located within the documents body ... ;)

... i cannot reproduce your next question ... the code works fine here ... for testing purpose try to set style='display: none' to your form and have a look whether it is hidden or not ...

kind regards
Jul 2 '07 #16
karen987
114 New Member
... yes of course ... all nodes that should be displayed by the browser has to be located within the documents body ... ;)

... i cannot reproduce your next question ... the code works fine here ... for testing purpose try to set style='display: none' to your form and have a look whether it is hidden or not ...

kind regards
#

Ok when i added this as you suggested to the form tag:

Expand|Select|Wrap|Line Numbers
  1. <form action="mailto:me@web.com" method="POST" enctype="multipart/form-data" id="my_form" name="pledgeForm" style='display:none'>
i submitted the form. The text shows, but the thank you message didn't show.

i'm thinking it may be just easier to close the window on submit, and a thank you comes in a small pop up afterwards for 3 seconds and closes by itself, would this be quicker?
Jul 2 '07 #17
gits
5,390 Recognized Expert Moderator Expert
you see the form with adding the style display:none? ... before submit? then it will not work ... i would need your entire html to test it out ... may be its due to something with your table (i am pretty sure) ... i wouldn't recommend more popups ... we will find it out ... you may pm me your entire html-file ... until the thread will get too long ... i'll post the relevant things here after having a look at it ...

kind regards
Jul 2 '07 #18
karen987
114 New Member
Gits,

I've solved it now, Apparently it was a div tag close or something, that was missing. Here is the code, that works, just in case you have a similar problem yourself ever. THe missing div is in line 25 and it's at the end of the "form action" tag

Thanks for all your help.

Expand|Select|Wrap|Line Numbers
  1. <html><head> 
  2.     <title>title</title> 
  3.     <link rel="STYLESHEET" type="text/css" href="styles.css"> 
  4.         <STYLE TYPE="text/css"> 
  5. <!-- 
  6. body {scrollbar-base-color: #4169E1} 
  7. --> 
  8.         </STYLE> 
  9.  
  10.  
  11.      <script> 
  12.             function toggle_display() { 
  13.                 var form   = document.getElementById('my_form'); 
  14.                 var thanks = document.getElementById('THANKS'); 
  15.                 form.style.display ='none'; 
  16.                 thanks.style.display='block'; 
  17.             } 
  18.         </script> 
  19.     </head>     
  20.     <body> 
  21. <div id="THANKS" style="display:none;"> 
  22.             Thank you for making this pledge. 
  23.             <a href="#" onClick="window.close();">Close</a> 
  24. </div> 
  25. <form action="mailto:me@web.com" method="POST" enctype="multipart/form-data" id="my_form" name="pledgeForm" style="display:block;">        </div>  
  26. <table width="538" align="center"> 
  27. the form content is here, and the bottom of the form is as below 
  28.  
  29. <tr><td align="left"><input type="submit" value="Email This Form" onClick="toggle_display();"/></td> </tr> 
  30.  
  31. </table>   
  32.   </form> 
  33.     </body> 
  34. </html> 
Jul 3 '07 #19
gits
5,390 Recognized Expert Moderator Expert
hi ...

it was not a missing div ... i looked over your code ... it was the invalid markup:

- table-end-tag was missing
- tags mustn't overlap
- table should be entirely within the form

... glad you find it out but be aware with the markup next time ;)

kind regards ...
Jul 3 '07 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2168
by: dmiller23462 | last post by:
I'm trying to create a submission page for users to request PC/LAN Access....If they select "Yes" in the field asking about if they need Non Standard Software, I want several other HTML fields to become visible....If they keep the dropdown box at "No" (default) then I want to submit the form "as is", keeping the inapplicable HTML fields hidden....I'm trying an "if statement" in ASP....Here's my code....I'm thinking that the if statement...
2
33809
by: Seth E Seligman | last post by:
I'm working on a web based file manager. The rename file function creates a new window with a form allowing the user to enter a new file name. Before the form gets submitted, I want to make sure that a valid file name (no "/" or "\" characters) was entered. If the validation functions returns true, the form should be submitted and the window closed. If the function returns false the form window should stay open so the use can enter a new file...
2
18719
by: Irvin Amoraal | last post by:
Process: I have a form which uploads a file from client to server written in PHP. When the user presses the submit button, I use the "onSubmit" event to execute javascript to open a child window containing some text and an animated GIF. The javascript returns 'True' and the file is uploaded. All of that works great. Problem: Now I am trying to close the child window after the file has been uploaded. Below is the JavaScript I'm using:
11
2959
by: JSjones | last post by:
when a form is submitted from the main window i want a pop up window to open from the onclick event. i have that working, now how can i close the pop up window from the main window after the main window finishes loading? i've been racking my brain on this for the last two days. here is the code for the parent window that i have been testing with. testfoo.htm is just a blank html page used for testing. <head>
2
3821
by: anonieko | last post by:
Scenario: You have a page that is TOO slow to refresh. But it allows partial flushing of html contents. I.e. Submit button already appears but you don't want your users to click on it prematurely because other parts are still coming. Here I put a javascript the will enable only submit button only after 5 seconds after the page is load fully.
3
1718
by: mcyi2mr3 | last post by:
Hi all I'm new to javascript and im trying to add a close button function to my certain pages of my site. I use this code: <a href='javascript:window.close();'>Close Window</a> to create a hyperlink which closes the window. However with pages which display data retrieved from a database using PHP i use a form to submit a search on the page which displays results. At the bottom of the page
1
3527
by: Matt Jensen | last post by:
Howdy I've got a ASP.NET webform page that pops up a window for a user to make a selection. Once they make a selection in this popup window, the form in the popup is submitted an update to the DB is fired, the window closes, and the opener window's (server) form is submitted (via JavaScript) (so that any form changes that were made are retained) and the newly loaded page shows the new selections from the popup window. However, the...
8
2669
by: Ed Jay | last post by:
I want to use history.go() to navigate between my previously loaded pages. I'm looking for a way to trigger a function call when a page is accessed using history.go(). Is there an event generated? Is there a method for detecting what page the user came from when a page is accessed using history.go()? -- Ed Jay (remove M to respond by email)
16
3150
by: whyyyy | last post by:
The script below works fine if the form is filled out and submitted. But a (blank) e-mail is sent whenever the page loads, even when the form is not submitted. I would like to receive the e-mail only when the form is submitted <%@LANGUAGE="VBSCRIPT"%> <% Set MyMail=CreateObject("CDO.Message")
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.