So I am trying to use FullCalendar and jQuery UI dialog box. And i'm not sure to sure how to go about placing the 2 together very well.
When I select or click on an empty day event, I want the jQuery Modal Dialog Box to pop up. ALTHOUGH I would like to have it load an internal file (php include). But the downfall with this is that I can't get it to close the dialog box when I get the form to submit
Also, by using this method I can't get it to pull the date that I clicked on to automatically fill in the start-date field.
What's the best route to go about mixing in the jQuery UI modal Dialog box with fullCalendar?
Any help would be appreciated. If possible is there a good method by loading an external file?
This is currently what I have:
select: function(start, end, date, allDay, jsEvent, view, calEvent) {
$("#addEventDialog").dialog("open");
$("#addEventDialog").load('dialog.CalendarNewEvent.php').dialog({
title: 'Add Event',
modal: true,
buttons: {
"Save": function() {
$("#calendarWidget2").ajaxSubmit({
target: "#calendarResponse",
dataType: 'json',
clearForm: true,
success: function(response, event) {
//If the widget says it's okay to refresh, refresh otherwise, consider it done
if(response.refreshEvents == '1') {
$("#calendar").fullCalendar("refetchEvents");
}
// Close the dialog box when it has saved successfully
$("#addEventDialog").dialog("destroy");
// Update the page with the reponse from the server
$("#calendarResponse").append("Successfully Added: "+ response.title +"<br />");
},
error: function() {
alert("Oops... Looks like we're having some difficulties.");
}
}); // Close ajax submit
},
"Cancel": function() { $(this).dialog("close"); }
}, //End buttons
});
//alert("The inputs will work if i un-comment this alert");
/* UPDATE ALL THE VALUES IN THE DIALOG BOX */
$("#startDate").val($.fullCalendar.formatDate(start, 'yyyy/MM/dd'));
$("#endDate").val($.fullCalendar.formatDate(end, 'yyyy/MM/dd'));
},
So like my code mentions, when I use this code, nothing gets updated... but yet when I use an ALERT function where I have it placed right now, and make it actually live... the input values will get updated for some reason. It's almost as if the function is acting to fast to make the values apply, so when I have the alert stop in there, it makes it work.... any thoughts?