here is html form :
<form id="form1" name="form1" action="toSQL.php" method="get" accept-charset="utf-8" onsubmit="return submitTest();">
<p><input type="text" name="Cliname" id="textfield" maxlength = "10" /></p>
<p><textarea name="message" id="message" maxlength = "20" ></textarea>
<input type="submit" value="submit" id="btn"/>
</form>
here is js:
<script type="text/javascript" >
function submitTest() {
if ( form1.textfield.value == "" ) {
alert( "enter your name!!" ) ;
form1.name.focus();
return false ;
}
if (form1.message.value == "" ) {
alert( "type the content!!" ) ;
form1.message.focus();
return false ;
}
}
</script>
alert is showed but it still send the form to sql. i have no idea :(