I have an email validation script on my page and a populate form fields script that doesn't work unless it's the only script written. Here are the scripts. Thanks

          <script type="text/javascript"><!--
function validateForm() {
with (document.drbrake) {
var alertMsg = "The following REQUIRED fields\nhave been left empty:\n";
if (fullname.value == "") alertMsg += "\nfullname";
if (emailcheck.value == "") alertMsg += "\nemailcheck";
if (telephone.value == "") alertMsg += "\ntelephone";
if (selectproduct.value == "") alertMsg += "\nselectproduct";
if (problem.value == "") alertMsg += "\nproblem";
if (alertMsg != "The following REQUIRED fields\nhave been left empty:\n") { alert(alertMsg);
return false;
} else {
return true;
// -->
</script>
        <script language="JavaScript1.2">
//Advanced Email Check credit-
//By JavaScript Kit (http://www.javascriptkit.com)
//Over 200+ free scripts here!
var testresults
function checkemail(){
var str=document.validation.emailcheck.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$ /i
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address!")
testresults=false
return (testresults)
        </script>
                            <script>
function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
</script>

I do see issues with the script, but do you realize that HTML5 has all this capability build in, so not a single bit of the code you posted is needed? Of course there may be a reason you are doing it the way you are, but I don't know what that reason would be.
In your forms, you can simply add "required" to an input field to make it required. And by making an email field the email type, it will automatically be validated for correctness. See below:
<input type='text' value='<?php echo last_name ?>' name='last_name' required />
<input type='email' value='<?php echo email ?>' name='email' required />
Assuming that your form is processed by PHP, you would then use further validation in PHP. But the HTML5 validation is just as good as javascript validation and easier to use.
With the HTML5 validation, all fields remain populated and the form cannot be submitted if anything fails validation.  I added the value attribute to the input examples because normally, if the PHP validation fails, you want to re-populate the form with what is stored in the POST array.

Similar Messages

Maybe you are looking for

  • Schedule lines should not change 3 weeks time from MRP date

    Hi Is there any specific customisation required to get following results in case of schedule lines. 1) MRP should not change/adjust the already send delivery schedule lines  which are lying within 3 weeks time from MRP date 2) System should not allow

  • My ipod touch no longer syncs

    my ipod touch no longer syncs with itune.

  • Creative cloud keeps asking me to license my software and then it asks for a serial number

    it keeps asking me to license my software and then it asks for a serial number, i do not have a serial number with creative cloud just a order number what do I do?

  • 2011 macbook connecting to projector

    i have an 2010/2011 Macbook Pro and I'm trying to connect it to a project. Last time I connected to a projector it just started up (2011) this time I have been trying to connect it and nothing happens. below is my Displays screen where  you'll see th

  • Sites As File

    Hi There, I am thinking about starting a small web design business just as a kind of "productive hobby" for now. My question is this... Can I create the website on iweb, save it as a File (instead of publishing to .me), and then send it to the custom