Ver Mensaje Individual
  #8 (permalink)  
Antiguo 25/06/2011, 09:52
Avatar de AdrianSeg
AdrianSeg
 
Fecha de Ingreso: enero-2010
Mensajes: 595
Antigüedad: 14 años, 3 meses
Puntos: 14
Respuesta: No consigo arar la ejecución del script

Si te referías a esto...tampoco funciona:

Código Javascript:
Ver original
  1. <script>
  2.  
  3.    
  4.    
  5. $(":button#validar").click(function () {
  6.             var $elegido =$("input[name=pi1]:checked");
  7.            
  8.             if ($elegido.val()) {
  9.                            
  10. $(function() {
  11.  
  12.  
  13. var root = $("#wizard").scrollable();
  14.  
  15. // creamos las dos variables que necesitaremos
  16.  
  17. var api = root.scrollable(), drawer = $("#drawer");
  18.  
  19. // parte logica usada en la validacion
  20.  
  21. api.onBeforeSeek(function(event, i) {
  22.  
  23. // recorremos toda la pagina
  24.  
  25. if (api.getIndex() < i) {
  26.  
  27. // en que pagina estamos
  28.  
  29. var page = root.find(".page").eq(api.getIndex()),
  30.  
  31. // buscamos los campos requeridos
  32.  
  33. inputs = page.find(".required :input").removeClass("error"),
  34.  
  35. // y comprobamos si estan vacios
  36.  
  37. empty = inputs.filter(function() {
  38.  
  39. return $(this).val().replace(/\s*/g, '') == '';
  40.  
  41. });
  42.  
  43. // si hay un campo vaco vamos a colorearlo
  44.  
  45.    
  46.  
  47. if (empty.length) {
  48.  
  49. drawer.slideDown(function()  {
  50.  
  51. // coloreamos usando estilos jquery
  52.  
  53. drawer.css("backgroundColor", "#229");
  54.  
  55. setTimeout(function() { drawer.css("backgroundColor", "#fff"); }, 1000);
  56.  
  57. });
  58.  
  59. empty.addClass("error");
  60.  
  61. return false;
  62.  
  63. // si todo esta bien seguimos
  64.  
  65.  
  66. } else {
  67.  
  68. // ocultamos la barra de aviso
  69.  
  70. drawer.slideUp();
  71.  
  72. }
  73.  
  74. }
  75.  
  76. // actulizamos la barra de estado
  77.  
  78. $("#status li").removeClass("active").eq(i).addClass("active");
  79.  
  80. });
  81.  
  82. // si persionamos siguiente nos vamos a pagina actual + 1
  83.  
  84. root.find("button.next").keydown(function(e) {
  85.  
  86. if (e.keyCode == 9) {
  87.  
  88. // ejecutamos la validacion logica
  89.  
  90. api.next();
  91.  
  92. e.preventDefault();
  93.  
  94. }
  95.  
  96. });
  97.  
  98. });
  99.  
  100.             } else {
  101.                 alert("NINGUN VALOR SELECCIONADO");
  102.                
  103.                 return false;
  104.  
  105.                  
  106.             }  
  107.  
  108.         });