hello,

i want to check for errors on submitting a form, on encountering an error it runs a function and returns a false preventing form submit. I have implemented that.

Code javascript:
function eCheck()
{
 var filePath = document.getElementsByName("fileSelect");
 
 if (filePath == '')
 {
  errorPath();
  return false;
 }
 
  return true;
}

Code HTML:
<form action="process.php" method="post" onSubmit="return eCheck();">

When i do the above, it isn't going through the check or rather not running the function errorPath(); and returning the value as false.

but when i do the following, errorPath(); works and form submit is called off.

Code HTML:
<form action="process.php" method="post" onSubmit="errorPath(); return false;">

but i want it to run the error check. Any ideas on way it's not working.

Thanks in Advance.