Hey,
I have a form which is validated client-side by some simple Javascript:
function validatecommentsform()
{
if(document.addcommentform.txtName.value == '')
{
alert('Please fill in the Name field.');
return false;
}
else if(document.addcommentform.txtComment.value == '')
{
alert('Comment field cannot be empty.');
return false;
}
else
{
document.addcommentform.commentformsubmitbutton.disabled = true
return true;
}
}
Then on the form my action points to the same page which has the code something like:
If($_POST['Submit'])
{
//code to insert data into db here
}
The problem is that if I use javascript to validate the form, no data seems to be inserted into the database. If I remove the onsubmit event from the form it then works.