R
Ron Eggler
Hi,
I have a function call in my form tag like this:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"
name="myform" id="myform" onsubmit="return chkform()">
and the function looks like:
<script type="text/javascript">
function chkform()
{
if (document.myform.first_name.value == "")
{
alert("Please enter your firstname!");
document.Formular.first_name.focus();
return false;
}
if (document.myform.last_name.value == "")
{
alert("Please enter your lastname!");
document.Formular.last_name.focus();
return false;
}
....
....
....
alert("SUBMIT!");
return true;
}
</script>
It can be checked out here: http://www.dvdnowkiosks.com/tmp/form.php
The form gets submitted even tho the function returns false, why this???
As soon as you hit the OK button from the alert box, data get submitted to
the php, why this? It shouldn't, no? What am i doing wrongly?
Thank you!
Ron
I have a function call in my form tag like this:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"
name="myform" id="myform" onsubmit="return chkform()">
and the function looks like:
<script type="text/javascript">
function chkform()
{
if (document.myform.first_name.value == "")
{
alert("Please enter your firstname!");
document.Formular.first_name.focus();
return false;
}
if (document.myform.last_name.value == "")
{
alert("Please enter your lastname!");
document.Formular.last_name.focus();
return false;
}
....
....
....
alert("SUBMIT!");
return true;
}
</script>
It can be checked out here: http://www.dvdnowkiosks.com/tmp/form.php
The form gets submitted even tho the function returns false, why this???
As soon as you hit the OK button from the alert box, data get submitted to
the php, why this? It shouldn't, no? What am i doing wrongly?
Thank you!
Ron