Hi,
I am using the following code for signup form. It was just a simple posting and showing error using speedopopup and everything was fine. Now I want to add jquery validation before posting to make sure fields are entered and email field is validated. I added the below validate code from the validate plugin but nothing is happening. It’s just ignoring that part and jumping to the $.post?
How can I fix it please?
- <form name="frmSignup" id="frmSignup" method="post" action="signup">
- <table align="center" cellspacing="20" cellpadding="0" style="width: 300px; float: right;">
- <tr><td align="center" style="padding: 5px;"><h1>SIGN UP</h1></td></tr>
- <tr><td align="center" valign="middle"><input type="text" name="txtSignupName" id="txtSignupName" style="width: 100%; text-align: center; direction: ltr;" maxlength="200" placeholder="Your Name" autocomplete="off" required></td></tr>
- <tr><td align="center" valign="middle"><input type="text" name="txtSignupLoginID" id="txtSignupLoginID" style="width: 100%; text-align: center; direction: ltr;" maxlength="200" placeholder="Student ID" autocomplete="off" required></td></tr>
- <tr><td align="center" valign="middle"><input type="email" name="txtSignupEmail" id="txtSignupEmail" style="width: 100%; text-align: center; direction: ltr;" placeholder="Email Address" autocomplete="off" required></td></tr>
- <tr><td align="center" valign="middle"><button id="btnSignup" type="submit" style="width: 100%;">Sign up</button></td></tr>
- <tr><td align="center" valign="middle"><button id="btnGotoSignin" type="button" style="width: 100%;">Sign in</button></td></tr>
- </table>
- </form>
- $('#frmSignup').validate({
- rules: {
- "txtSignupName": {
- required: "hellooooo" }
- }
- }); //
-
-
- // post sign up;
- $('#btnSignup').click(function()
- {
- $.post
- (
- 'signup',
- {
- 'name': $('#txtSignupName').val(),
- 'user': $('#txtSignupLoginID').val(),
- 'email': $('#txtSignupEmail').val()
- },
- function(data)
- {
- if (data == "success")
- {
- $.fn.speedoPopup(
- {
- theme: "light",
- caption: "Sign up",
- effectIn: "fade",
- htmlContent: "Thank you.<br><br>An administrator will review and activate your account shortly.",
- onClose: function ()
- {
- $('#signup').hide("slow");
- $('#signin').show("slow");
- }
- });
- }
- else
- {
- $.fn.speedoPopup(
- {
- theme: "light",
- caption: "Sign up",
- // autoClose: 8000,
- effectIn: "fade",
- htmlContent: "<b>ERROR!</b><br><br>Failed to signup.<br><br>user already exist!."
- });
- }
- }
- );
-
- return false;
- });