Question : HTML Form w/js input validation

Xperts,
 Im pretty new to programming and am attempting to create an html form that uses JavaSript to allow for input validation. I am able to get alerts in all failed validations but i get the blank page of death after clicking okay after the email alert.

additionally, I am unsure as to how to code the submit button to take all of the validated input and attatch them to an email.

Skrap
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {
		alert(alerttxt);return false;
		}
  else
  {
	  return true;
	  }
  }
}

function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}
 
function validate_form(thisform)
{
with (thisform)
  {
  if (validate_required(FieldData1,"The 'Your Name' field must be filled out!")==false)
  {FieldData1.focus();return false;}
  if (validate_required(FieldData2,"The 'City' field must be filled out")==false)
  {FieldData2.focus();return false;}
  if (validate_required(FieldData3,"The 'State' field must be filled out!")==false)
  {FieldData3.focus();return false;}
  if (validate_required(FieldData4,"The 'Phone Number' field must be filled out!")==false)
  {FieldData4.focus();return false;}
  if (validate_email(email,"Valid Email Required!")==false)
  {email.focus();return ;}
    }
}
</script>
</head>

<body>

<form action="submit.htm" onSubmit="return validate_form(this);" method="post">
	<table align="center"cellpadding="2" cellspacing="0" border="0" bgcolor="#7DA7D9">
   
		   <tr>
            <td align="left">
        		<font face="Arial" size="3" color="#000000">
        			<b class="gold">Name</b><p class="contact" style="font-size:16px; font-weight:bold; font-style:inherit; color:#FF0">
                                	Please be sure to fill all text fields so that we can route your message properly</p> 
   			    </font> 
        	<div style="" id="mainmsg"></div>
            
            </td>
           </tr>
    </table>
         <br>
         	<tr valign="top"> 
            	<td width="214" align="right"><font face="Arial" size="3" color="#000000">Your Name: </font></td> 
                <td width="272" align="left"><input type="text" name="FieldData1" size="15"> </td>
            </tr>
            
            <tr valign="top"><td align="right"><font face="" size="3" color="#000000">City: </font></td> 
            	<td align="left"><input type="text" name="FieldData2" size="20"> </td>
            </tr>
            <tr valign="top"> <td align="right"><font face="Arial" size="3" color="#000000">State: </font></td> 
            	<td align="left"><input type="text" name="FieldData3" size="2"> </td>
            </tr>
             
                <td align="right"><font face="Arial" size="3" color="#000000">Phone Number: </font></td> 
                <td align="left"><input type="text" name="FieldData4" size="15"> </td></tr><tr valign="top"> 
                
                </td>
             </tr>
             <tr valign="top"> <td align="right"><font face="Arial" size="3" color="#000000">Email: </font></td> 
             	<td align="left"><input type="text" name="email" size="20"> </td>
             </tr>
             <tr valign="top"> <td align="right"><font face="Arial" size="3" color="#000000">Detailed description of your inquiry: </font>
                  	</td> 
                    <td align="left"><textarea name="FieldData5" cols="30" rows="3"></textarea>
		<br> 
					</td>
                  </tr>
                  
                  <tr> 
                  	<td colspan="2">
                    </td>
                  </tr>
                  <tr> 
                  	<td> 
                    </td> 
                    <td align="right"><input type="text" name="hida2" value="" maxlength="100" size="3" style="display : none;">
                    				<input type="submit" class="btn" value="Submit Request" name="Submit">    
                                    <input type="reset" class="btn" value="  Clear Form  " name="Clear">
                    </td>
                  </tr>
                  <tr>
                  
                  	<td colspan=2 align="center">
<br>
                    </td>
                  </tr>
                
 </table>
</form>  
</body>

</html>

Answer : HTML Form w/js input validation

dear friend u can use dream weaver for validation ur form                                                http://www.youtube.com/watch?v=KpJnwbyxUE4

view this video and u can go also the

http://www.w3schools.com/site/site_validate.asp

on this site for check ur validation
enjoy,
Random Solutions  
 
programming4us programming4us