473,770 Members | 1,785 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 #1
23 3240
gits
5,390 Recognized Expert Moderator Expert
hi,

let me give you an idea on how to do what you want. you may give your form an id and create an additional div with what you want to have displayed when the form is submitted. now set the style visibility of the div to hidden. on submitting the form you toggle the visibility-style of your two containers (the form and the div -> make the form visibility hidden and the div visbility visible).

now you may add a button with window.close() action or set a timeout that closes you window after a given amout of time ...

kind regards ...
Jul 2 '07 #2
gits
5,390 Recognized Expert Moderator Expert
ahh ... and let me mention that the id is for the simpe use of getElementById ... that you may use for getting a ref to your container-node ;)

kind regards
Jul 2 '07 #3
karen987
114 New Member
Thank you to all who replied. Can i make it clear i'm not html savvy and don't understand all this html lingo.

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.

Expand|Select|Wrap|Line Numbers
  1. <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?

Expand|Select|Wrap|Line Numbers
  1.       <td align="left"><input type="submit" value="Email This Form"> 
  2. </form> 
  3. <DIV ID="THANKS" style="display: none;"> 
  4. Thank you for making this pledge. 
  5. <P> 
  6. <a href="#" onClick="window.close();">Close</a> </DIV> 
  7.  
  8. </table> 
  9.  
  10.   </body> 
  11. </html> 
Jul 2 '07 #4
gits
5,390 Recognized Expert Moderator Expert
... it WILL work on an html-page ... and we have to use javascript for that what you want ... i've got a problem to solve here at the office ... after that i'll reply again with some hints ... in case no other expert helped you with that ...

kind regards ...
Jul 2 '07 #5
gits
5,390 Recognized Expert Moderator Expert
hi ...

have a look at the following example and try to adapt it to your needs:

[HTML]
<html>
<head>
<script>
function toggle_display( ) {
var form = document.getEle mentById('my_fo rm');
var thanks = document.getEle mentById('THANK S');

form.style.disp lay = 'none';
thanks.style.di splay = 'block';
}
</script>
</head>

<body>
<form id="my_form" name="pledgeFor m">
something to display here
<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();">Clos e</a>
</div>
</body>
</html>
[/HTML]
kind regards ...
Jul 2 '07 #6
karen987
114 New Member
Thank you Gits,

I tried this, see the (modified code below)but didn't receive the email. 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

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>
at the beginning of the form i put
Expand|Select|Wrap|Line Numbers
  1. <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

Expand|Select|Wrap|Line Numbers
  1. <input type="button" value="Email This Form" onclick="toggle_display();"/>
  2.         </form>
  3.         <div id="THANKS" style="display:none;">
  4.             Thank you for making this pledge. 
  5.             <a href="#" onclick="window.close();">Close</a>
  6.         </div>
  7.     </body>
  8. </html>
THank you for your patience and time, and to anyone else who may have something to add here.
Jul 2 '07 #7
gits
5,390 Recognized Expert Moderator Expert
... ;) you have to submit your form ... always have a look at the sample code carefully ... don't use it without doubt ... its an example only ... try to understand what it does, and then adapt it to your needs. have a look at the type of the button ... i changed this to 'button' instead of 'submit' ...

kind regards ...
Jul 2 '07 #8
gits
5,390 Recognized Expert Moderator Expert
it should disappear ... do you get an error-message? does the sample work for its own? (i tested with firefox and it worked the way you want) ...

kind regards ...
Jul 2 '07 #9
karen987
114 New Member
Ok i changed the word "button" to "submit". When i click submit, it does go through now. What happens exactly, is that the form remains there and the thank you mesage at the bottome. On top of all this, there is the separate windows pop up that submits the email. You have to click yes a couple of times then the email goes thru. Once it is sent, then you see the old page again, with the "thanks" line and "close" button at the bottom.

Is there any way i can make the text (except the thank you and close) disappear when i submit?

Many thanks
Jul 2 '07 #10

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
18718
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
2958
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
1717
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
3526
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
9617
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
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
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...
1
10037
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
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...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.