UPDATE: I believe I am onto something, this link brought new lights to my problem. Below is the code that works fine with my application. It's probably a bit dirty, but so far, my tests gave me good results.
<script type='text/javascript'>
// Calendar for all pages except for HOME
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
theme: true,
firstDay: 1,
editable: false,
events: "json-events.php?list=1&<?php echo $events_list; ?>",
<?php if($_GET['page'] == 'home')
echo "defaultView: 'agendaWeek',";
?>
eventClick: function(event) {
if (event.url) {
window.open(event.url);
return false;
}
},
dayClick: function(date, allDay, jsEvent, view) {
if (view.name == 'month') {
$('#calendar').fullCalendar( 'changeView', 'agendaDay').fullCalendar( 'gotoDate', date );
}else{
if(allDay)
{
var timeStamp = $.fullCalendar.formatDate( date, 'dddd+dd+MMMM_u');
var $eventDialog = $('<div/>').load("json-events.php?<?php echo $events_list; ?>&new=1&all_day=1×tamp=" + timeStamp, null, validForm).dialog({
autoOpen:false,
draggable: false,
width: 675,
modal:true,
position:['center',202],
resizable: false,
title:'Add an Event',
buttons: {
'Add an Event': function() {
var options = {
success: function() {
$('#eventDialog').dialog().empty().remove();
$("#addEvent").empty().remove();
$('#calendar').fullCalendar( 'refetchEvents' );
}
};
// Manually trigger validation
if ($("#addEvent").validate().form() == true) {
$('#addEvent').ajaxSubmit(options);
$('#eventDialog').dialog('close');
}
},
Cancel: function() {
$("#addEvent").empty().remove();
$(this).dialog().empty().remove();
}
}
});
//$eventDialog.dialog('open').attr('id','eventDialog');
$eventDialog.dialog('open', {
open: function(event, ui) { $validForm; }
}).attr('id','eventDialog');
}
else
{
var timeStamp = $.fullCalendar.formatDate( date, 'dddd+dd+MMMM_u');
var $eventDialog = $('<div/>').load("json-events.php?<?php echo $events_list; ?>&new=1&all_day=0×tamp=" + timeStamp, null, validForm).dialog({
autoOpen:false,
draggable: false,
width: 675,
modal:true,
position:['center',202],
resizable: false,
title:'Add an Event',
buttons: {
'Add an Event': function() {
var options = {
success: function() {
$('#eventDialog').dialog().empty().remove();
$("#addEvent").empty().remove();
$('#calendar').fullCalendar( 'refetchEvents' );
}
};
// Manually trigger validation
if ($("#addEvent").validate().form() == true) {
$('#addEvent').ajaxSubmit(options);
$('#eventDialog').dialog('close');
}
},
Cancel: function() {
$("#addEvent").empty().remove();
$(this).dialog().empty().remove();
}
}
});
//$eventDialog.dialog('open').attr('id','eventDialog');
$eventDialog.dialog('open', {
open: function(event, ui) { $validForm; }
}).attr('id','eventDialog');
}
}
}
});
function validForm(){
$("#addEvent").validate({
rules: {
calendar_title: "required",
calendar_url: {
required: false,
maxlength: 100,
url: true
}
},
messages: {
calendar_title: "Title required",
calendar_url: "Invalid URL format"
}
});
}
});
</script>
Thanks again for taking the time to help me.