Solved

Close window after onsubmit of form

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
COldFusion html Display 10 104
Agile 2 148
Web Developer 7 266
Web Expression 4 + PHP v5.5 2 53
When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
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.
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now