javascript return true not working
<p>i have used the following code for javascript validation, that return true or false depending on the condition</p>

<p>javascript block</p>

<pre><code>function fnval()
{
 if(document.field.value == "")
 {
  alert("Invalid value");
   return false;
 }else{
   return true;
 }
}
</code></pre>

<p>Here is my HTML:    </p>

<pre><code>&lt;Input type=submit name="sub" onClick="return fnval()"&gt;
</code></pre>

<p>Thus the js block checks if the field value is entered or not. If not it throws an alert message and return false, and hence the form does not get submitted.<br>
But in case the value is not empty it returns a true, and still the form does not get submitted.</p>

<p>I have seen some queries asked by people where return false results in submission of the form. But this is exactly opposite.. and am not able to find a solution as of now.<br>
Can anyone please help me on this?</p>
