PDA

View Full Version : Popup Windows & Submit Values


BBargains
10-22-2002, 02:55 AM
Hi,

I'm using a form within a pup up box, and I am trying to get the submit value to work in conjunction with the window close.

So when the user hits the submit button, the information is sent to my database & closes the pop up window.

This is the code I have tried...(Unsuccessfully).

I can get one or the other to work, but not together.

<input type="submit" value="Find Me The Best Price !" onClick="window.close()">

I would appreicate if someone can help me out.

Cheers,
Rob.

glenngv
10-22-2002, 03:41 AM
what's the server-side language are you using?

<form name="f" action="yourActionPage" method="post">
...
<input type="submit" value="Find Me The Best Price !">
</form>

then in your yourActionPage:
(this is a sample ASP page, delimeter will depend on what your server-side language is)

<%
'codes here that saves data to database
%>

<html>
<head>
<title>Record saved.</title>
<script language="javascript">
setTimeout("window.close()",3000);//3 seconds delay
</script>
</head>
<body>
<form>
Record saved.<br>
Window will close automatically.<br>
Click the button below if you do not want to wait any longer or if the browser does not close.<br>
<input type="button" value="Close" onclick="window.close()">
</form>
</body>
</html>

you may want to check if there is no error in saving the database. if error occurs, then you can display a different message.

chrismiceli
10-22-2002, 03:41 AM
i think when you have <form action="whatever()"> just put window.close in the form action function after everything else.