amigos ya logro que al darle cancelar se limpie el campo de texto me falta que se limpien los checkbox
les muestro mi codigo
Código Javascript
:
Ver originalselect: function(start, end, allDay) {
$("#dialog-form").dialog('open');
$( "#dialog:ui-dialog" ).dialog( "destroy" );
var title = $( "#title" ),
allFields = $( [] ).add( title ),
tips = $( ".validateTips" );
function updateTips( t ) {
tips
.text( t )
.addClass( "ui-state-highlight" );
setTimeout(function() {
tips.removeClass( "ui-state-highlight", 1500 );
}, 500 );
}
function checkLength( o, n, min, max ) {
if ( o.val().length > max || o.val().length < min ) {
o.addClass( "ui-state-error" );
updateTips( "Length of " + n + " must be between " +
min + " and " + max + "." );
return false;
} else {
return true;
}
}
function checkRegexp( o, regexp, n ) {
if ( !( regexp.test( o.val() ) ) ) {
o.addClass( "ui-state-error" );
updateTips( n );
return false;
} else {
return true;
}
}
$( "#dialog-form" ).dialog({
autoOpen: false,
height: 580,
width: 850,
modal: true,
buttons: {
"Crear Nuevo Evento": function() {
var bValid = true;
allFields.removeClass( "ui-state-error" );
bValid = bValid && checkLength( title, "title", 3, 80 );
bValid = bValid && checkRegexp( title, /^[a-z]([0-9a-z_])+$/i, "Username may consist of a-z, 0-9, underscores, begin with a letter." );
var arrayOpt = new Array;
$('input[type=checkbox]').each(function() {
if ($(this).attr('name') == 'opcion[]') {
if ($(this).attr('checked') == 'checked') {
arrayOpt.push($(this).val());
}
}
});
//alert (arrayOpt);
$("#start").val($.fullCalendar.formatDate(start, 'MM/dd/yyyy HH:mm:ss'));
$("#end").val($.fullCalendar.formatDate(end, 'MM/dd/yyyy HH:mm:ss'));
$("#allDay").val(allDay);
var titleq = $("#title").val();
var startq = $("#start").val();
var endq = $("#end").val();
var allDayq = $("#allDay").val();
var nombre = $("#autor").val();
/*$('#modal').each (function(){
this.reset();
});*/
if ( bValid ) {
$.ajax({
url:'archivo.php',
type:'post',
data:'opciones='+arrayOpt+'&title='+titleq+'&start='+startq+'&end='+endq+'&allDay='+allDay+'&nombre='+nombre,
}).done(function(data) {
//alert(titleq+" "+arrayOpt+" "+startq+" "+endq);
$('#calendar').fullCalendar( 'refetchEvents' )
});
$( this ).dialog( "close" );
}
//$( this ).dialog( "close" );
},
Cancelar: function() {
$( this ).dialog( "close" );
}
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
}