0

Hello.

This is probably something very simple that I am missing (Or something that I have done wrong), but upon filling in and validating all fields of the form and pressing the "Register" button nothing happens; Usually the page would reload as if the form had been submitted.

The code is below. Thank you in advance.

`

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<title>jQuery Form Validation</title>

</head>
<body>
<form id="DemoForm"
<form method = 'post' action = 'jTest1.8.html' id = 'DemoForm' name = 'DemoForm'>
    Username<br />
    <input type="text" id="user_input" name="username" /><br>
    Email<br />
    <input type="text" id="email" name="email" /><br>       
</form>
<div id="test">
</div>

<!--Rules & Messages-->

<!--Username-->

<!--Email-->
      <script src = 'jquery.validate.min.js'></script>    
      <script>
         $('#DemoForm').validate ({
            rules: {
                        'email': {
                                    required:'true',
                                    email: 'true',
                                    }
                      },
                      messages:{
                           'email':{
                           required:'Please submit your email.',
                           email:'Enter a valid email.',
                                       }
                                       },


                                                   });
      </script>


</body>

</html>

<!--Password Validation-->
<script src = 'jquery.validate.min.js'></script>
<form id="DemoForm">
<form method = 'post' action = 'jTest1.8.html' id = 'DemoForm' name = 'DemoForm'>
<label for="password">Password</label><br>
<input id="password" name="password" />
<br/>
<label for="password_again">Again</label><br>
<input class="left" id="password_again" name="password_again" />
<br>

<input type="submit" id="register" value="Register" />
</form>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://jqueryvalidation.org/files/dist/jquery.validate.min.js"></script>
<script src="http://jqueryvalidation.org/files/dist/additional-methods.min.js"></script>
<script>
// just for the demos, avoids form submit
jQuery.validator.setDefaults({
  debug: true,
  success: "valid"
});
$( "#myform" ).validate({
  rules: {
    password: "required",
    password_again: {
      equalTo: "#password"
    }
  }
});
</script>

`

4
Contributors
5
Replies
13
Views
2 Years
Discussion Span
Last Post by Troy III
0

UPDATE: It now appears to be submitting, but the validation for the password fields do not throw errors when incorrect. Very confused.

0

Hi,

Please could you post the resolution as I would be interested to see what it was?

Kind Regards,

Piers

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.