I am trying to validate the fields in the form and trying to POST the input after validating form the server however I am able to validate the fields but not able to POST the data form the field, please help if anyone could.

<!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" lang="en" xml:lang="en">
<head>
<title>Contact Us</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <SCRIPT LANGUAGE="JavaScript">
function readText (form) {
    varFname=form.fName.value;
	varLname=form.lName.value;
	varEname=form.eMail.value;
	varComment=form.comment.value;
	if(varFname=="")
	{
    alert("Please enter your First Name.");
    form.fName.focus();
    return false;
	}
	else if(varLname=="")
	{
	alert("Please enter your Last Name.");
	form.lName.focus();
	return false;
	}
	
else if ((varEname.indexOf(".", 0) < 0) || (varEname.indexOf("@", 0) < 0) || varEname=="" || varEname.length < 5)
	{
	alert("Please enter valid E-mail address.");
	form.eMail.focus();
	return false;
	}
	else if(varComment=="")
	{
	alert("Please enter questions or comments.");
	form.comment.focus();
	return false;
	}
	else
	{	
	alert ("Form submitted successfully");
	return true;
	}
}
</script>	
</head>
<body>
<FORM NAME="myform" ACTION="http://webdevfoundations.net/scripts/formdemo.asp" METHOD="POST">
	 <fieldset><legend>Questions or Comments:</legend><br />
       <label>First Name: <INPUT TYPE="text" NAME="fName" VALUE=""><br /></label><br />
       <label>Last Name: <INPUT TYPE="text" NAME="lName" VALUE=""><br /></label><br />
       <label>E-Mail:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="text" NAME="eMail" VALUE=""></label> <br /><br />
     </fieldset> <br />
       <label>Questions or Comments:<br /></em>
    <textarea ROWS="4" COLS="60" NAME="comment" VALUE=""></textarea></label><br /><br />
    <INPUT TYPE="Button" NAME="Submit" Value="Submit"onClick=" readText(this.form)"/>  
    <input type="reset" />
</FORM>
</body>
</html>

Two issues:-
1. The input type at line 55 should of type "submit"
2. onClick should return true/false to stop/start sending data to server.

Line 55 should be

<INPUT TYPE="submit" NAME="Submit" Value="Submit" onClick="return readText(this.form)"/>

Thank you so much !!! It worked !!

You are welcome.
Please mark this thread as solved!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.