Jump to content

Form Validation Not Working


phpforsilk

Recommended Posts

Hello PHP Gurus - I have a php form that has some validation code within it that I can't seem to figure out why it isn't working on a particular server.  http://www.fidus.com/test/pcb_layout_form.php  - the form emails results and returns the "thankyou page" but it doesn't recognize the validation script on the particular server it is on.  I have tested it on another server and it works.

 

Can anyone help?  Not sure what else you require in order to review the issue, so please advise.

 

Thanks so much - I am pulling my hair out to firgure this out.

 

Thanks!

Link to comment
Share on other sites

Thank you - here is the code.

 


<script language="JavaScript" type="text/javascript">

function validate() 

{

      if (document.forms['form1'].elements['FirstName'].value == "") {

       alert("Please enter your first name");

        return false;

     }

      if (document.forms['form1'].elements['LastName'].value == "") {

        alert("Please enter your last name");

        return false;

     }

                  if (document.forms['form1'].elements['CompanyName'].value == "") {

                      alert("Please enter your Company name");

                      return false;

     }

                  if (document.forms['form1'].elements['Add1'].value == "") {

                      alert("Please enter your address");

                      return false;

     }

                  if (document.forms['form1'].elements['City'].value == "") {

                      alert("Please enter your city");

                      return false;

     }

                  if (document.forms['form1'].elements['ProvState'].value == "") {

                      alert("Please enter your Province/State");

                      return false;

     }

                 if (document.forms['form1'].elements['Country'].value == "") {

                                      alert("Please enter your Country");

                                      return false;

     }

                 if (document.forms['form1'].elements['Telephone'].value == "") {

                                      alert("Please enter your Phone Number");

                                      return false;

     }

                 if (document.forms['form1'].elements['Email'].value == "") {

                                      alert("Please enter your Email address");

                                      return false;

     }

                 if (document.forms['form1'].elements['New Design'].value == "") {

                                      alert("Please enter your Project Scope");

                                      return false;

     }

                                 if (document.forms['form1'].elements['Pins'].value == "") {

                                                      alert("Please enter your number of Pins");

                                                      return false;

     }

                 if (document.forms['form1'].elements['Parts'].value == "") {

                                      alert("Please enter your number of components");

                                      return false;

     }

                 if (document.forms['form1'].elements['Nets'].value == "") {

                                      alert("Please enter your number of Nets");

                                      return false;

     }

                                 if (document.forms['form1'].elements['layers'].value == "") {

                                      alert("Please enter your number of layers");

                                      return false;

     }

                                 if (document.forms['form1'].elements['counts'].value == "") {

                                                      alert("Please enter your signal layer count");

                                                      return false;

     }

return true ;

}

</script>


</head>
      
<table cellspacing="0" cellpadding="0">
                <tr>
                  <td align="center"><a href="/index.php" class="headerlinks"><b>Home</b></a> | <a href="/contactus.php" class="headerlinks"><b>Contact Us</b></a>  | <a href="/sitemap.php" class="headerlinks"><b>Site Map</b></a> <br />

                    <br />                    
                    <div align="center"><form name="form1" id="form1" style="padding:0px; margin:0px;"> 
      
        <select name="menu1" onchange="MM_jumpMenu('parent',this,0)" style="border: solid #6C8DAC 1px; background: #FFFFFF; color: #76777A; font-size:10px;">
                        <option selected="selected" style="color:#101C44;">I need to know . . .</option>
                        <option value="/expertise.php">What do you do?</option>
                        <option value="/Company/choosefidus.php">Why Fidus?</option>
                        <option value="/careers.php">Are you hiring?</option>
                        <option value="/contactus.php">How can I contact you?</option>

                        <option value="/search.php">I'd like to search for...</option>
                        <option value="mailto:info@fidus.com">The answer to my question is not here ...</option>
<option value="mailto:Feedback@fidus.com?subject=A suggestion for Fidus">Fidus suggestion box</option>
          </select>
        
                                </form> 
<form name="form1" form action="FormToEmail.php" method="post"  onsubmit="return validate()">
  <p align="left" class="style1"><strong>PCB Layout Quote Form </strong></p>
  <table border="1" cellspacing="0" cellpadding="0" width="571">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.