View Full Version : Thank You popup after Submission of Form

03-04-2009, 04:04 AM
Hey there.

I'm looking to figure out a simple operation here, but getting stuck in the process. I have about... zero knowledge of the language this would be done in. I have a form (http://www.bucketbux.com/referralspam.php) where I would like a popup to appear once the submission of the form has been completed.

Here is what I have thus far:

<script language="javascript" type="text/javascript">
function vaidation()
var form = document.refspam;

if (form.ref_link.value == '' || form.email.value == '')
alert ('Please fill out the form completely before clicking submit!');
return false;

return true;

If you notice, a window will appear if the form has not been filled out completely. I'm just not sure how to do what is, essentially the opposite. :P

Help is appreciated! Thank you. =]

Philip M
03-04-2009, 08:37 AM
Surely function vaidation() should be function validation()

To create a pop-up, place the following right before return true;

var popWin = "";
function openwin(url, strWidth, strHeight) {
if (popWin != "") {popWin.close()}
leftStr = (screen.width-strWidth)/2;
topStr = (screen.height-strHeight)/2-50;
windowProperties = "toolbar=no,menubar=no,scrollbars=no,statusbar=no,height="+strHeight+",width="+strWidth+",left="+leftStr+",top="+topStr+"";
popWin = window.open(url,'newWin',windowProperties);

Where the page yourURL.html contains the text of the message. Obviously you can change the size of the window to suit.

You asked for a pop-up. Be aware that many browsers block pop-up windows these days. Or do you mean just a simple alert?

If so, right before return true add:-

alert ("Thank you for submitting the form");

He thought he saw a Rattlesnake
That questioned him in Greek:
He looked again, and found it was
The Middle of Next Week.
"The one thing I regret," he said,
"Is that it cannot speak!"
- Lewis Carroll

03-04-2009, 09:52 AM
Unbelievable. I can't believe I didn't figure that out...

(Yes, by the way - it was the alert I was looking for.)

The same piece of code was used right before return false! Well, the simplest things are often the easiest to mess up, right?

Also, thanks for catching the validation typo. I did notice that after posting this thread but didn't think of editing it here. =]

Well, I tested the page and the alert works properly. Thank you very much! :thumbsup:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum