Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/04/2012, 23:12
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
borrar los campos de formulario que esta en una ventana modal de jquery

Hola amigos espero me ayuden

necesito limpiar los campors de un formulario que esta en una ventana modal de jquery

hasta el momento logro que el formulario se limpie cuando se envian los datos pero cuando le doy cancelar se cierra la venta modal y al volver a cargarla no se han borrado siguen los datos


Código Javascript:
Ver original
  1. function(start, end, allDay) {
  2.            
  3.          $("#dialog-form").dialog('open');
  4.          $( "#dialog:ui-dialog" ).dialog( "destroy" );
  5.          
  6.          
  7.                  
  8.         $( "#dialog-form" ).dialog({
  9.             autoOpen: false,
  10.             height: 650,
  11.             width: 700,
  12.             modal: true,
  13.             buttons: {
  14.                 "Crear Nuevo Evento": function() {
  15.                         var arrayOpt = new Array;
  16.               $('input[type=checkbox]').each(function() {
  17.                         if ($(this).attr('name') == 'opcion[]') {
  18.                             if ($(this).attr('checked') == 'checked') {
  19.                                 arrayOpt.push($(this).val());
  20.                                
  21.                             }
  22.                         }
  23.                     });
  24.          $("#start").val($.fullCalendar.formatDate(start, 'MM/dd/yyyy HH:mm:ss'));
  25.          $("#end").val($.fullCalendar.formatDate(end, 'MM/dd/yyyy HH:mm:ss'));
  26.          $("#allDay").val(allDay);
  27.                
  28.                 var titleq = $("#title").val();
  29.                 var startq = $("#start").val();
  30.                 var endq = $("#end").val();
  31.                 var allDayq = $("#allDay").val();
  32.                
  33.                  
  34.              
  35.               $('#modal').each (function(){
  36.               this.reset();
  37.               });
  38.                  
  39.                   $.ajax({
  40.                   url:'archivo.php',
  41.                   type:'post',
  42.                   data:'opciones='+arrayOpt+'&title='+titleq+'&start='+startq+'&end='+endq+'&allDay='+allDay,
  43.                   }).done(function(data) {
  44.                
  45.                  $('#calendar').fullCalendar( 'refetchEvents' )
  46.                
  47.    
  48.                   });
  49.                     $( this ).dialog( "close" );
  50.                                        
  51.                    
  52.                 },
  53.                
  54.                
  55.                 Cancelar: function() {
  56.                     $( this ).dialog( "close" );
  57.                    
  58.                    
  59.                 }
  60.             },
  61.             close: function() {
  62.                 allFields.val( "" ).removeClass( "ui-state-error" );
  63.             }
  64.         });
  65.  
  66.                
  67.        },