Hi all
I have a form that collects input from the user and by clicking the "submit" button the data is saved in a database.
I would like to modify that form to do the following:
Upon pressing the "submit" button, the data will be saved in the database AND a confirmation would be issued to the user that his/her entry was OK. I want that message to popup, remain on screen for 10 seconds, close itself and bring the user back to the main page.
The first problem I'm having is with the setTimeout() function. When I use it, it disappear after the specified time, however it brings the user to the calling frame, NOT the main page.
The second problem is I don't know how to "sequence" the two actions - save data to database and then popup the confirmation window - by clicking the "Submit" button only once. Here is the code:
*************** snip - the form Entry.htm *************
.
.
******** snip - the popup window Confirmation.asp ********
********************************************************
This will bring the user to the main page but he/she will have to click the "x" on the small window to close it manually!
********************************************************
....and here I'm having the problem...
I appreciate any help!! -Tivoli0
I have a form that collects input from the user and by clicking the "submit" button the data is saved in a database.
I would like to modify that form to do the following:
Upon pressing the "submit" button, the data will be saved in the database AND a confirmation would be issued to the user that his/her entry was OK. I want that message to popup, remain on screen for 10 seconds, close itself and bring the user back to the main page.
The first problem I'm having is with the setTimeout() function. When I use it, it disappear after the specified time, however it brings the user to the calling frame, NOT the main page.
The second problem is I don't know how to "sequence" the two actions - save data to database and then popup the confirmation window - by clicking the "Submit" button only once. Here is the code:
*************** snip - the form Entry.htm *************
.
.
Code:
<!-- Define the entry form & Check proper fields entry -->
<form onSubmit="return formValidation(this)" id="entryForm" name="entryForm" action="../ASP/confirmation.asp" method="post">
.
.
<font color="limegreen"><input id="submit1" name="submit1" type="submit" value="Submit"></font></td>
</form>
Code:
<script Language="Javascript">
<!--
// Define a variable for message window
var w = open('about:blank', 'thankYouWin',
'width=300,height=175,resizable=1,scrollbars=1');
//Define a variable for message text
var html = '';
//Compose the message
html += '<HTML><BODY>'
+ '<H2><font color=blue>Thank you for your correct form entries.</font><\/H2>'
+ 'Your form has been submitted.'
+ '<\/BODY><\/HTML>';
w.document.open();
w.document.write(html);
parent.window.location="../html/homepage.htm";
This will bring the user to the main page but he/she will have to click the "x" on the small window to close it manually!
********************************************************
....and here I'm having the problem...
Code:
//Can use this function to have message closed and desappear:
//w.document.close();
//setTimeout('w.close()', 2000)
//-->
</script>