<form name=\"demo\" onsubmit=\"return validateFormOnSubmit(this)\" action=\"\">
<form method=\"post\" action=\"contact.php\">
if (reason != \"\") { alert(\"Some fields need correction:\n\" + reason); return false; } alert(\"All fields are filled correctly\"); //this is the part that says everything is done correctly return false;}
I have a form script in PHP and it works well, but it does not validate the HTML Fields.
I found on a site a javascript validation, it works well in test mode, which is before it is sent to the PHP script to email.
I have the script starting like this for testing the javascript validator:
without the validation I normally let the srcipt work.
How can I get the validation to work and when it is all valid, it automatically posts to the contact php?
within the javascript I have this piece of code:
I stupidly did not return it as true.
it now works very well, now to implement it to my clients.