jQ Modal and ASP Custom Validator not firing
I'm new to using jQueryUI (and most Dev work in general) I'm creating an intranet ASP forms site for work, and wanted to use jQuery modals for quite a few applications, most of which involve user input and therefore validation...but for the life of me I can't get my ASP Customer validator to work when the DIV is a modal. Everything works fine if I have the Modal div visible and use it in the page, but even with everything visible if I then use the below to create a modal using it whether I use the modal button to click the ASP button or set the z-index to a high number and use it within the div the ASP button's 'onserverclick' event fires without the custom validator being used, I've also added Page.Validate() to the top of onclick event for the ASP button to no avail.
The below is taken from the original, as I mentioned above I have tried not hiding the ASP buttons and the DIV and it had no affect, any help or light shed is GREATLY appreciated. Thanks in advance.
// Show the Login Dialog <script> function showLogin() { $("#login-dialog").dialog({ height: 380 , width: 500 , modal: true , buttons: { 'Login': { text: "Login" //Login Dialog Login Submit button function , click: function () { $("#<%=LoginSubmit.ClientID()%>")[0].click(); return false; } } , 'Register': { text: "Register" //Login Dialog Register Button , click: function () { $("#<%=RegisterButton.ClientID()%>")[0].click(); return false; } } } }); };
<%--Login dialog Div--%> <div id="login-dialog" title="Please Login or Register" hidden="hidden"> <p>If you have already setup an Operator ID you can enter it below, otherwise please register for one.</p> <asp:RequiredFieldValidator runat="server" ControlToValidate="LoginOperatorID" ErrorMessage="Operator ID is required." CssClass="field-validation-error" /> <asp:RegularExpressionValidator runat="server" ControlToValidate="LoginOperatorID" ErrorMessage="Operator ID must be 4-9 digits" CssClass="field-validation-error" ValidationExpression="[0-9]{4,9}" /> <table id="LoginTable"> <tr> <td>Operator ID:</td> <td><input type="password" runat="server" id="LoginOperatorID" maxlength="9" /></td> <asp:CustomValidator ID="LoginSubmitValidator" runat="server" EnableClientScript="true" Enabled="true" ErrorMessage="Operator ID does not exist." ControlToValidate="LoginOperatorID" OnServerValidate="CheckLoginID" CssClass="field-validation-error" /> </tr> </table><br /> <input type="button" runat="server" id="LoginSubmit" onserverclick="SubmitLogin" hidden="hidden" causesvalidation="true" /> <input type="button" runat="server" id="RegisterButton" hidden="hidden" onserverclick="RegisterDialog" causesvalidation="false" />
'Validate Operator Login Sub Protected Sub CheckLoginID(source As Object, args As ServerValidateEventArgs) args.IsValid = False End Sub
'Submit Operator Login Sub Sub SubmitLogin() Page.Validate() ..... End Sub