Required fields check in asp.net textbox
<p>How can I implement a clientsidevalidation required textfields which contain the following texts:</p>

<p>[Name required]
[Address required]</p>

<p>Preferrably I would like to use the asp:CustomValidator if possible? Only if both fields have data the postback will be triggered?</p>

<pre><code>     &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
    &lt;title&gt;&lt;/title&gt;
    &lt;script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;        var $j = jQuery.noConflict();&lt;/script&gt;
    &lt;script type="text/javascript"&gt;


        function otherMessageValidator_ClientValidation(source, args) {
            args.IsValid = false;

            var nm = $j("#name");

            if (nm.val() != "" &amp;&amp; nm.val() != "[Name required]") {
                args.IsValid = true;
            }

            return args.IsValid;
        };
    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;
        &lt;asp:TextBox ID="name" runat="server" ValidationGroup="valgroup"&gt;[Name required]&lt;/asp:TextBox&gt;
        &lt;asp:TextBox ID="address" runat="server" ValidationGroup="valgroup"&gt;[Address required]&lt;/asp:TextBox&gt;
    &lt;/div&gt;
    &lt;asp:Button runat="server" ID="but1" Text="go" OnClick="but1_Click" /&gt;
    &lt;asp:CustomValidator ID="MyCustomValidator" runat="server" ValidationGroup="valgroup"
        ClientValidationFunction="otherMessageValidator_ClientValidation" ErrorMessage="At least one textbox needs to be filled in." /&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
