Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2013
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    jQuery Validation stoped working

    Hi

    I have a page to submit a registration form. the jQuery validation was working. Now sudently stoped doing the validation in the form.

    Here is the complete page (printed from the page source)
    Code:
    <html>
    <head>
    <title>Amizades Coloridas</title>
      <link rel="stylesheet" type="text/css" href="/css/css.css">
      <link rel="stylesheet" type="text/css" href="/css/zebra_dialog.css">
    	<link rel="stylesheet" href="/css/jquery.ui.all.css">
    	<link rel="stylesheet" href="/css/demos.css">
      
    	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    	<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
      <script type="text/javascript" src="/js/zebra_dialog.js"></script>
      <script type="text/javascript" src="/js/notification.js"></script>
    
    	<script src="/jquery/jquery-1.8.0.js"></script>
    	<script src="/jquery/jquery.ui.core.js"></script>
    	<script src="/jquery/jquery.ui.widget.js"></script>
    	<script src="/jquery/jquery.ui.accordion.js"></script>
    
      <script>
    	$(function() {
    		$( "#accordion" ).accordion({
    			collapsible: true
    		});
    	});
    
    	function over(name){
    	  overname = 'over_' + name;
    	  outname  = 'out_'  + name;
    	  document.getElementById(outname).style.display  = 'none';
    	  document.getElementById(overname).style.display = '';
    	}
    	
    	function out(name){
    	  overname = 'over_' + name;
    	  outname  = 'out_'  + name;
    	  document.getElementById(outname).style.display  = '';
    	  document.getElementById(overname).style.display = 'none';
    	}
    	</script>
    
    	<script type="text/javascript">
      	$(document).ready(function(){
      		$('#reg-form').validate({
    
      			rules: {
      				fname: { required: true },
      				lname: { required: true },
      				uname: { required: true, minlength: 5, maxlength: 8 },
      				pwd1: { required: true, minlength: 5, maxlength: 8 },
      				pwd2: { required: true, minlength: 5, maxlength: 8, equalTo: '#pwd1' },
      				email: { required: true, email: true }
      			},
    
      			messages: {
      				fname: { required: 'Tem que introduzir o seu primeiro nome' },
      				lname: { required: 'Tem que introduzir o seu ultimo nome' },
      				uname: { required: 'Tem que introduzir o seu nome de utilizador', minlength: 'O nome de utilizador tem um comprimento minimo de 5 caracteres', maxlength: 'O nome de utilizador tem um comprimento máximo de 8 caracteres' },
      				pwd1: { required: 'Tem que introduzir a senha', minlength: 'A senha tem um comprimento minimo de 5 caracteres', maxlength: 'A senha tem um comprimento máximo de 8 caracteres' },
      				pwd2: { required: 'Tem que introduzir a senha', minlength: 'A senha tem um comprimento minimo de 5 caracteres', maxlength: 'A senha tem um comprimento máximo de 8 caracteres', equalTo: 'As Senhas não coorespondem' },
      				email: { required: 'Tem que introduzir o seu endereço de email', email: 'Tem que introduzir um endereço de email válido' }
      			},
    
            errorPlacement: function(error, element) {
               error.appendTo( element.parent("td").next("td") );
             },
      
            submitHandler: function(form) {
                form.submit();
            }
      		});
      	});
    	</script>
    </head>
    <body>
      <div class = "page_header">
        <div class = "login_box">
          <span><a href='login.php'>ENTRAR</a> | <a href='register.php'>REGISTO</a></span>    </div>  
      </div>  <ul class="nav">
        <li><a href="/index.php">HOME</a></li>
        <li><a href="/profile.php">PERFIL</a></li>
        <li><a href="/online_members.php">MEMBROS ONLINE</a></li>
        <li><a href="/messages.php">MENSAGENS PESSOAIS</a></li>
        <li><a href="/contact.php">CONTACTO</a></li>
      </ul>
    
      <div id = "reg_form">
        <div class = "header">
          <span>Faça o seu registo nas Amizades Coloridas</span>
        </div>
    
        <div class = "body">
        	<form method="post" action="register.php" id="reg-form">
            <table>
              <tr>
                <td><label>Introduza o Primeiro Nome: </label></td>
                <td><input type="text" id = "fname" name="fname" value="" /></td>
                <td></td>
              </tr>
              <tr>
                <td><label>Introduza o Ultimo Nome: </label></td>                
                <td><input type="text" id = "lname" name="lname" value="" /></td>
                <td></td>
              </tr>
              <tr>
                <td><label>Introduza o Nome de Utilizador: </label></td>
                <td><input type="text" id = "uname" name="uname" value="" /></td>
                <td></td>
              </tr>
              <tr>
                <td><label>Introduza a Senha: </label></td>
                <td><input type="password" id = "pwd1" name="pwd1" value="" /></td>
                <td></td>
              </tr>
              <tr>
                <td><label>Confirme a Senha: </label></td>
                <td><input type="password" id = "pwd2" name="pwd2" value="" /></td>
                <td></td>
              </tr>
              <tr>
        		    <td><label>Introduza o Seu Endereço de Email: </label></td>
                <td><input type="text" id = "email" name="email" value="" /></td>
                <td></td>
              </tr>
              <tr>
        		    <td align = "center" colspan = "2" align = "center"><input type = "submit" class = "submit" name="send" value="Registar" /></td>
                <td></td>
              </tr>
            </table>
        	</form>
        </div>
      </div>
    </body>
    <div class = "footer">Amizades Coloridas - &copy; 2014<br>Contacte o <a href = 'contact.php'>Administrador</a> das Amizades Coloridas.</div>
    
    </html>
    and the CSS for the form code

    Code:
    /* Register Form */
    #reg_form .body{ 
      width: 800px;
      padding: 20px 10px 20px 10px;
      margin: 10px;
      border: 1px solid #cecece;
      background-color: #ffffcc;
      margin-left: auto;
      margin-right: auto;
    }
    
    #reg_form .header{ 
      width: 800px;
      margin-top: 10px;
      padding: 20px 10px 20px 10px;
      text-align: center;
      border: 1px solid #cecece;
      background-color: #6699ff;
      margin-left: auto;
      margin-right: auto;
    }
    
    #reg_form label {
      font-family: Arial, Helvetica, sans-serif;
      font-style: normal;
      font-size: 15px;
      font-weight: normal;
      margin: 5px;
      color: #565656;
    }
    
    #reg_form label.error {
      font-family: Arial, Helvetica, sans-serif;
      font-style: normal;
      font-size: 10px;
      font-weight: normal;
      margin: 5px;
      color: #ff0000;
    }
    
    #reg_form input {
      border: 1px solid #cecece;
      width: 150px;
      height: 25px;
      margin: 5px;
      float: right;
    }
    
    #reg_form input.error {
      border: 1px solid #ff0000;
      width: 150px;
      height: 20px;
      margin: 5px;
    }
    
    #reg_form .submit {
      border: 1px solid #404040;
      width: 100px;
      height: 25px;
      margin: 5px;
    }
    Can someone help me finding what changed?

    Thank You

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,575
    Thanks
    23
    Thanked 643 Times in 642 Posts
    Where is the jQuery validation code?
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #3
    New Coder
    Join Date
    May 2013
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Right at the beginning of the page:

    <script type="text/javascript">
    $(document).ready(function(){
    $('#reg-form').validate({

    rules: {
    fname: { required: true },
    lname: { required: true },
    uname: { required: true, minlength: 5, maxlength: 8 },
    pwd1: { required: true, minlength: 5, maxlength: 8 },
    pwd2: { required: true, minlength: 5, maxlength: 8, equalTo: '#pwd1' },
    email: { required: true, email: true }
    },

    messages: {
    fname: { required: 'Tem que introduzir o seu primeiro nome' },
    lname: { required: 'Tem que introduzir o seu ultimo nome' },
    uname: { required: 'Tem que introduzir o seu nome de utilizador', minlength: 'O nome de utilizador tem um comprimento minimo de 5 caracteres', maxlength: 'O nome de utilizador tem um comprimento máximo de 8 caracteres' },
    pwd1: { required: 'Tem que introduzir a senha', minlength: 'A senha tem um comprimento minimo de 5 caracteres', maxlength: 'A senha tem um comprimento máximo de 8 caracteres' },
    pwd2: { required: 'Tem que introduzir a senha', minlength: 'A senha tem um comprimento minimo de 5 caracteres', maxlength: 'A senha tem um comprimento máximo de 8 caracteres', equalTo: 'As Senhas não coorespondem' },
    email: { required: 'Tem que introduzir o seu endereço de email', email: 'Tem que introduzir um endereço de email válido' }
    },

    errorPlacement: function(error, element) {
    error.appendTo( element.parent("td").next("td") );
    },

    submitHandler: function(form) {
    form.submit();
    }
    });
    });
    </script>

  • #4
    New Coder
    Join Date
    May 2013
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts
    On the debugger get this error: SCRIPT438: Object doesn't support property or method 'validate'.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •