Clienside validation before server side
===

My issues:

1) Postback always occurs

2) Is that the correct way to see if requiredFieldValidator is valid client side?

What I would like:

User clicks the visible click button.

This invokes isValid().

If page is valid then invoke server side function.

If page is invalid do alert.



    <asp:Button ID="btnSubmit" runat="server" Text="Submit" ToolTip="Submit" CausesValidation="true" CssClass="blueNew buttonNew" 
                    OnClientClick="isValid(); return false;" />

    <div style="display: none;">
        <asp:Button ID="hiddenBtnSubmit" runat="server"  OnClick="btnSubmit_Click" />
     </div>

     <script>
    function isValid() {
        if (Page_IsValid) {
            var button = document.getElementByID("<%=hiddenBtnSubmit.ClientID%>");
            button.click();
        } else {
            if (!reqFirstName.IsValid) {
                alert("First name is invalid");
            }
        }      
    }
     </script>