Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/09/2012, 18:18
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: validar mas de una ventana modal - jquery Dialog

amigos he intentado y he hasta el momento llevo lo siguiente

Código Javascript:
Ver original
  1. var namec = $( "#namec" ),
  2. allFieldsc =$( [] ) .add( namec )
  3.  
  4. function updateTipsc( t ) {
  5.             tipsc
  6.                 .text( t )
  7.                 .addClass( "ui-state-highlight" );
  8.             setTimeout(function() {
  9.                 tips.removeClass( "ui-state-highlight", 1500 );
  10.             }, 500 );
  11.         }
  12.  
  13.  
  14. function checkLengthc( o, n, min, max ) {
  15.             if ( o.val().length > max || o.val().length < min ) {
  16.                 o.addClass( "ui-state-error" );
  17.                 updateTipsc( "Length of " + n + " must be between " +
  18.                     min + " and " + max + "." );
  19.                 return false;
  20.             } else {
  21.                 return true;
  22.             }
  23.         }
  24.  
  25.  
  26. function checkRegexpc( o, regexp, n ) {
  27.             if ( !( regexp.test( o.val() ) ) ) {
  28.                 o.addClass( "ui-state-error" );
  29.                 updateTipsc( n );
  30.                 return false;
  31.             } else {
  32.                 return true;
  33.             }
  34.         }
  35. $( "#dialog-modificar" ).dialog({
  36.             autoOpen: false,
  37.             height: 600,
  38.             width: 800,
  39.             modal: true,
  40.             buttons: {
  41.                 "Modificar Destinatario": function() {
  42.                     var bValidc = true;
  43.                     allFielldsc.removeClass( "ui-state-error" );
  44.                     bValidc = bValidc && checkLengthc( namec, "usernamec", 3, 16 );

y por medio de firebug me marca el siguiente error ReferenceError: allFielldsc is not defined

y me marca la siguiente linea de codigo allFielldsc.removeClass( "ui-state-error" );

leyendo un poco creo que tengo este mismo problema http://stackoverflow.com/questions/6...-generated-ids
pero no se como solucionarlo por eso acudo a ustedes


en la misma pagina tengo

<div id="dialog-modificar" title="Modificar Destinatario">
<p class="validateTipsc">All form fields are required.</p>
<div id="insert">
<div class="columnas" id="col_1"><div id="consulta3"></div>
<label for="name">Nombre</label>
<input type="text" name="namec" id="namec" value="" class="text ui-widget-content ui-corner-all" />


</div>

Última edición por Montes28; 23/09/2012 a las 18:30