Solved

Close window after onsubmit of form

Posted on 2004-10-07
3
5,781 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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.
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 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…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

739 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