Solved

Close window after onsubmit of form

Posted on 2004-10-07
3
5,780 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
New Website 15 33
Visual Studio 2013  Distorts Chrome Browser 2 182
how can i add my web site and domain to be found in google search 5 123
Eclipse for PHP 1 115
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to Import and export files in WordPress. 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 : Click on Too…

763 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