Validate Plugin problem

Validate Plugin problem

Hello, I'm new with Jquery and I have a problem with the validation plugin.

The scenario is as follow:

I have 4 files:

1. An html file with a link.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Cargador de B</title>
  6. <script type="text/javascript" src="jquery_min.js"></script>
  7. <script type="text/javascript" src="jquery.validate.min.js"></script>
  8. <script type="text/javascript" src="js/a.js"></script>
  9. </head>
  10.  
  11. <body>
  12. <div><a href="#" id="cargarb">Pincha para cargar as&iacute;ncronamente la  p&aacute;gina B</a></div>
  13. <div id="destinob"></div>
  14. </body>
  15. </html>

2. An java script file that catch the click event in the first file and execute an .ajax() function to load form in other div.

  1. var $j = jQuery.noConflict();
  2. $j(document).ready(function(){
  3.  
  4.     $j("a#cargarb").click( function()
  5.                             {
  6.                                 $j.ajax(
  7.                                     {
  8.                                         url:'b.php',
  9.                                         success: function(resultado)
  10.                                                     {
  11.                                                         $j('#destinob').html(resultado);
  12. $j.getScript('js/b.js');
  13.                                                     }
  14.                                     });
  15.  
  16.                                 
  17.                                 return false;
  18.                             }
  19.                         );
  20.  
  21.  
  22. });

3. Php file with the html code for the form to validate.

  1. <form class="regForm" id="login_form" name="form1" method="post" action="">
  2.   <fieldset>
  3.   <legend>Formulario de Ingreso</legend>
  4.   <p>
  5.     <label for="reg_email">Email:</label>
  6.     <input type="text" name="reg_email" id="reg_email">
  7.   </p>
  8.   <p>
  9.     <label for="reg_password">Clave</label>
  10.     <input type="password" name="reg_password" id="reg_password">
  11.   </p>
  12.   <p>
  13.     <label for="reg_sesion">No cerrar sesi&oacute;n</label>
  14.     <input type="checkbox" name="reg_sesion" id="reg_sesion">
  15.   </p>
  16.   </fieldset>  
  17.   <p>
  18.     <input type="submit" name="reg_submit" id="reg_submit" value="Ingresar">
  19.     <input type="reset" name="reg_clean" id="reg_clean" value="Limpiar">
  20.   </p>
  21.   
  22. </form>

4. The last one file is a Javascritpt file tha use the validate function over the form in the php file.

  1. $j("#login_form").validate({
  2. rules:{
  3. reg_email: {
  4. required: true,
  5. email: true
  6. },
  7. reg_password:{
  8. required: true
  9. }
  10. },
  11. messages:{
  12. reg_email: {
  13. required: "Ingrese su Email",
  14. email: "Ingrese un email válido"
  15. },
  16. reg_password:{
  17. required: "Escriba una contraseña"
  18. }
  19. }
  20. });

This code works for all web browser except Internet Explorer (Any version).

Im using the latest version of jquery and the validation plugin.

I note if I put the form, the validation script in the same file. The code works fine in all web browsers.



Example.

html file

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <script src="jquery_min.js" language="JavaScript"></script>
  7. <script src="jquery.validate.min.js" language="JavaScript"></script>
  8. <script src="validate.js" language="JavaScript"></script>
  9. </head>
  10. <body>
  11. <form id="login_form" name="form1" method="post" action="">
  12.   <fieldset>
  13.   <legend>Formulario de Ingreso</legend>
  14.   <p>
  15.     <label for="reg_email">Email:</label>
  16.     <input type="text" name="reg_email" id="reg_email">
  17.   </p>
  18.   <p>
  19.     <label for="reg_password">Clave</label>
  20.     <input type="password" name="reg_password" id="reg_password">
  21.   </p>
  22.   <p>
  23.     <label for="reg_sesion">No cerrar sesi&oacute;n</label>
  24.     <input type="checkbox" name="reg_sesion" id="reg_sesion">
  25.   </p>
  26.   </fieldset>  
  27.   <p>
  28.     <input type="submit" name="reg_submit" id="reg_submit" value="Ingresar">
  29.     <input type="reset" name="reg_clean" id="reg_clean" value="Limpiar">
  30.   </p>  
  31. </form>
  32. </body>
  33. </html>
the js file

  1. $(document).ready(function(){
  2. $("#login_form").validate({
  3. rules:{
  4. reg_email: {
  5. required: true,
  6. email: true
  7. },
  8. reg_password:{
  9. required: true
  10. }
  11. },
  12. messages:{
  13. reg_email: {
  14. required: "Ingrese su Email",
  15. email: "Ingrese un email válido"
  16. },
  17. reg_password:{
  18. required: "Escriba una contraseña"
  19. }
  20. }
  21. });
  22. });

I need the form appear when I click in the link.

The problem looks like when the validation is call in other file.

Thanks

Jose