disallow Search on Empty form field
<p>I have a form field and I have to see that search button is clicked only when there is some 
data in the form field.
The following is the code. 
</p>

<pre><code>    &lt;script type="text/javascript"&gt;
        function IsEmptySearch(TxtField){
        var re = /\s/g; //any white space
        var str = TxtField.replace(re, "");
        if (str.length == 0) {
        return true;
        } else {return false;}
        } 
    &lt;/script&gt;

&lt;div&gt;
&lt;form id="formsearch" name="formsearch"  /&gt;
&lt;input type="text" name="TxtField" maxlength="255" class="findSearch" value="Enter Search..." 
  onfocus="if (this.className=='findSearch') { this.className = ''; this.value = ''; }"
  onblur="if (this.value == '') { this.className = 'findSearch'; this.value = 'Enter Search...'; }"/&gt;
&lt;input type="button" value="Search" onclick="return IsEmptySearch()" &gt;
&lt;/form&gt;
&lt;/div&gt;
</code></pre>

<p>The above is not working, as the form gets submitted, even though the Search field is empty.</p>

<p>On Debug the error is showing at "onclick="return IsEmptySearch()" "
 kindly help.   </p>
