D
Dknight
Hi, all!
I have a problem, how can I check a form data before sending it to
server. I have the example below, but first data is sent to server, but
after JavaScript checks the data
I need that JavaSctipt check data and after send it to the server, how
can do that?
Example:
....
<script language="javascript">
function check()
{
if(document.forms[0].name1.value == "")
{
alert("enter name");
return false;
}
else return true;
}
</script>
....
<form action="someapp.php" onSubmit="return check()">
<input type="text" name="name1">
<input type="submit">
</form>
....
Thanks in advance!
I have a problem, how can I check a form data before sending it to
server. I have the example below, but first data is sent to server, but
after JavaScript checks the data
I need that JavaSctipt check data and after send it to the server, how
can do that?
Example:
....
<script language="javascript">
function check()
{
if(document.forms[0].name1.value == "")
{
alert("enter name");
return false;
}
else return true;
}
</script>
....
<form action="someapp.php" onSubmit="return check()">
<input type="text" name="name1">
<input type="submit">
</form>
....
Thanks in advance!