Need help with form validation

Discussion in 'JavaScript' started by jluyt, Apr 18, 2008.

  1. #1
    Hi all,

    I am not a programmer, but need to validate these 3 form fields with JS. Is there anyone that would be so kind as to show me how the JS code should be to validate these 3 simple fields?

    I need to do a proper check for EMAIL, PHONE and NAME. Proper email format, phone format and all 2 fields - not empty.

    Sincerely,
    Justin

    Here is the code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
      <title></title>
    </head>
    <body>
    <form name="" method="post" action="http://nochargevacations.com/12all/box.php" accept-charset="utf-8">
      <table border="0" cellpadding="0" cellspacing="0" width="212">
    
        <tbody>
          <tr>
    
            <td width="75">
            <div align="right">E-mail</div>
            </td>
    
            <td>
            <div align="right">
            <input name="email" id="email" size="16" type="text">
            </div>
            </td>
    
          </tr>
    
          <tr>
    
            <td width="75">
            <div align="right">Name</div>
            </td>
    
            <td>
            <div align="right">
            <input name="name" id="name" size="16" type="text">
            </div>
            </td>
    
          </tr>
    
          <tr>
    
            <td>Phone</td>
    
            <td><input name="field[1,0]" value="" type="text"></td>
    
          </tr>
    
          <tr>
    
            <td width="75">
            <div align="right"> </div>
            </td>
    
            <td> 
            <div align="left"> <input name="funcml" value="add" checked="checked" type="radio">Subscribe
            </div>
            </td>
    
          </tr>
    
          <tr>
    
            <td width="75">
            <div align="right"> </div>
            </td>
    
            <td> 
            <div align="left"> <input name="funcml" value="unsub2" type="radio">Unsubscribe
            </div>
            </td>
    
          </tr>
    
          <tr>
    
            <td width="75">
            <div align="right">
            <input name="p" id="p" value="1" type="hidden">
            <input name="nlbox[1]" value="1" type="hidden">
            </div>
            </td>
    
            <td> 
            <div align="right">
            <br>
    
            <input name="Submit" value="Submit" type="submit">
            </div>
            </td>
    
          </tr>
    
        </tbody>
      </table>
    
    </form>
    </body>
    </html>
    
    Code (markup):

     
    jluyt, Apr 18, 2008 IP
  2. WebGeek182

    WebGeek182 Active Member

    Messages:
    510
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    95
    #2
    WebGeek182, Apr 18, 2008 IP