Forum Moderators: open

Message Too Old, No Replies

form submits while loading

         

aquanev

2:17 am on May 12, 2005 (gmt 0)

10+ Year Member



Hi,
I have a small php contact form that emails the contact info. to me.

<form name="form1" method="post" onSubmit="return formvalidation(this)" action="<?php echo $me;?>" >

I have done the javascript validation which works fine when the form is loaded.
But if I type the url while loading basically an empty form submits and I get a blank email.

How do I prevent the page from submitting when it is being loaded and secondly once I submit the data how do I call another page.
Thanx!

Bernard Marx

8:04 am on May 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do I prevent the page from submitting when it is being loaded _?

var pageLoaded = false;
window.onload = function(){ pageLoaded = true;}

Then, add to the first line of the validation function:

if(!pageLoaded) return false;

once I submit the data how do I call another page _?

Redirect the page with PHP.