Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Close window after onsubmit of form

Posted on 2004-10-07
3
Medium Priority
?
5,792 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 1500 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

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.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
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…
Suggested Courses

618 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