Solved

Close window after onsubmit of form

Posted on 2004-10-07
3
5,777 Views
Last Modified: 2013-12-24
Hi there,

I have a webpage let's say "StartPage.htm"
For reservation a user can press a button on this page and a new window pops up.

This new window "Reservation.htm" has a form. The entered data in this form can be send via Email with a buttonclick (submit).
A few fields in the form a mandatory and are validated.
Like this:
<tr>
  <td width="30%"><font color="#000080" size="2">Naam</font></td>
  <td width="13" align="center" valign="bottom"><font color="#FF0000">
  *</font></td>
  <td width="230"><font color="#000080">
  <!--webbot bot="Validation" s-display-name="Naam" b-value-required="TRUE" i-minimum-length="2" i-maximum-length="256" --><input type="text" size="35" maxlength="256" name="Naam" style="font-family: Arial; font-size: 10pt; color: #000080"></font></td>
</tr>


The code to submit the form's data is:

<form action="mailto:DummyEmail@hccnet.nl" method=POST enctype="text/plain" style="font-family: Arial; font-size: 10px; color: #000080" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">

Now I want to close the window "Reservation.htm" after validating the required fields and submitting the data to Email. This way the "StartPage.htm" is activated again.
(Probably the data is validated always before the onsubmit is activated in the <form action=......)

Thanks for your help,
Stef
0
Comment
Question by:Delphiwizard
  • 3
3 Comments
 
LVL 14

Expert Comment

by:hhammash
ID: 12249845
Hi,

Try this


<form action="mailto:DummyEmail@hccnet.nl" method=POST enctype="text/plain" style="font-family: Arial; font-size: 10px; color: #000080" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1"; window.close();>

hhammash
0
 
LVL 14

Expert Comment

by:hhammash
ID: 12250851
Hi,

Another solution is to put the following code on the top of a page  call it SubConf:

<script language=”javascript”>
window.close()
</script>



Now after the form submits let is post to the Subconf as the confirmation page.

When you send a form to an email,  in the options you can put the confirmation page.  Put the code I gave you at the top of the confirmation page.  Don't put anything on that page,  just leave it blank.

In this way you can make sure that the form has been submitted successfully,  then it sends to the confirmation which will close itself.  The user will lose the form,  the form will close.

regards
hhammash
0
 
LVL 14

Accepted Solution

by:
hhammash earned 500 total points
ID: 12251569
Hi,

Forget all above.  This is a working solution:

As I understand,  you have a link,  you click on the link and a new window opens with  the form in it.  Now open it in HTML view and add this linke to the <form> tag:

onsubmit="window.close();"

The linke should look like:

<form method="POST" action="--WEBBOT-SELF--" onsubmit="window.close();">


I tried it.  I received an email,  and the window closed.

Regards
hhammash
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
wordpress plugin to view newspaper 3 58
Python  -  List Iteration output problem 2 71
Adobe Certified Expert? 1 105
USPS CityStateLookup question 3 79
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question