Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6025019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:14:27+00:00 2026-05-23T04:14:27+00:00

I am currently working away with FullCalendar, which is pretty cool and has done

  • 0

I am currently working away with FullCalendar, which is pretty cool and has done a lot of neat stuff for me. The only problem I’m having is that if I edit an event, and then try and create another event the javascript seems to hold onto the initial events data.

I am using calendar.fullCalendar(‘unselect’) when I need the link to end, but it doesn’t seem to make a difference no matter what I do. I’m hoping you guys might be able to see something I’m overlooking.

<script type='text/javascript'>

    $(document).ready(function() {

        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();

         var calendar = $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            defaultView: 'agendaWeek',
            selectable: true,
            unselectAuto: true,
            selectHelper: true,
            editable: true,
            select: function(start, end, allDay) {
                //var title = prompt('Event Title:');
                //var desc = prompt('Event Description:');
                //calendar.fullCalendar('unselect');    

                $('#eventStart').val(start);
                $('#eventEnd').val(end);
                $('#eventAllDay').val(allDay);

                $('#formName').fadeIn();

                $('.closeSchedule a').click(function(){
                    $('#formName').fadeOut('slow');

                    $('#calendar').fullCalendar('unselect');    
                    //alert(jsEvent);
                });
            },
            events: [
                <?php

                 $first = true;

                 foreach ($events as $event)
                 {

                    if ($first == true)
                    {
                        $comma = '';
                        $first = false;
                    }
                    else
                    {
                        $comma = ',';
                    }

                     echo $comma."
                     {
                        id: '".$event->id."',
                        title: '".addSlashes($event->title)."',
                        start: '".$event->start."',
                        end: '".$event->end."',
                        allDay: ".$event->allDay."
                    }";
                    $first = false;
                 }

                ?>
                            ],

            eventClick: function(event) {
                //alert(event.id);


                $.ajax({
                  url: './schedule/getEdit/'+event.id,
                  success: function(data) {
                    var formEmpty = $('formName').html();
                    $('#formName').html(data);
                    $('#formName').fadeIn('fast');

                    $('.closeSchedule a').click(function(){
                        $('#formName').fadeOut('slow');
                        $('#calendar').fullCalendar('unselect');
                    });

                    $('#deleteEvent').live('click', function(){
                        var answer = confirm("Are you sure you wish to delete this event?")

                        if (answer){
                            $.ajax({
                               type: "POST",
                               url: "./schedule/deleteEvent/"+event.id,
                               success: function(msg){

                                  $('#formName').fadeOut('fast');            

                                  calendar.fullCalendar( 'removeEvents', [event.id ] )
                                  $('#calendar').fullCalendar('unselect');
                               }
                            });
                        }

                    }); 

                    $('#updateEvent').live('click', function(){

                        var title       = $('#eventName').val();
                        var trainerID   = $('#eventTrainer').val();
                        var trainer     = $('#eventTrainer option:selected').text();
                        var classID     = $('#eventType').val();
                        var eventType   = $('#eventType option:selected').text();
                        var eventStart  = $('#eventStart').val();
                        var eventEnd    = $('#eventEnd').val();
                        var eventAllDay = $('#eventAllDay').val();

                        if (eventAllDay == 'false')
                        {
                            allDay = false;
                        }
                        else
                        {
                            allDay = true;
                        }



                    // This runs the ajax to add the event to the database.
                    newData = 'title='+title+'&trainerID='+trainerID+'&classID='+classID+'&start='+eventStart+'&end='+eventEnd+'&allDay='+allDay

                    $.ajax({
                       type: "POST",
                       url: "./schedule/updateEvent/"+event.id,
                       data: newData,
                       success: function(msg){

                         event.title = title;

                         calendar.fullCalendar('rerenderEvents');

                         //calendar.fullCalendar('unselect');
                         $('#calendar').fullCalendar('unselect');
                       }
                     });



                    $('#formName').fadeOut('fast');
                    $('#eventName').val('');
                    $('#eventTrainer').val();
                    $('#eventType').val();  


                    });
                  }
                });

            },
            eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc) {


                    newData = 'start='+event.start+'&end='+event.end+'&allDay='+allDay

                    $.ajax({
                       type: "POST",
                       url: "./schedule/updateEventTime/"+event.id,
                       data: newData,
                       success: function(msg){

                       }
                     }); 
            },
            eventResize: function(event,dayDelta,minuteDelta,revertFunc) {

                newData = 'start='+event.start+'&end='+event.end+'&allDay='+event.allDay

                $.ajax({
                   type: "POST",
                   url: "./schedule/updateEventTime/"+event.id,
                   data: newData,
                   success: function(msg){

                   }
                 }); 

            }
        }); 



        $('#submitEvent').click(function(){
                    $('#calendar').fullCalendar('unselect');
                    var title       = $('#eventName').val();
                    var trainerID   = $('#eventTrainer').val();
                    var trainer     = $('#eventTrainer option:selected').text();
                    var classID     = $('#eventType').val();
                    var eventType   = $('#eventType option:selected').text();
                    var eventStart  = $('#eventStart').val();
                    var eventEnd    = $('#eventEnd').val();
                    var eventAllDay = $('#eventAllDay').val();

                    if (eventAllDay == 'false')
                    {
                        allDay = false;
                    }
                    else
                    {
                        allDay = true;
                    }



                    // This runs the ajax to add the event to the database.
                    newData = 'title='+title+'&trainerID='+trainerID+'&classID='+classID+'&start='+eventStart+'&end='+eventEnd+'&allDay='+allDay

                    $.ajax({
                       type: "POST",
                       url: "./schedule/addEvent",
                       data: newData,
                       success: function(msg){

                         var description = '<ol><li>'+title+'</li><li>'+trainer+'</li><li><a href="#" target="_blank">'+eventType+'</a></li><li class="eventID hide">'+msg+'</li>';

                         calendar.fullCalendar('renderEvent',
                            {
                                id: msg,
                                title: title,
                                description: description,
                                start: eventStart,
                                end: eventEnd,
                                allDay: allDay

                            },
                            true // make the event "stick"
                         );


                         calendar.fullCalendar('unselect');
                         //calendar.fullCalendar( 'rerenderEvents' )
                       }
                     });



                    $('#formName').fadeOut('fast');
                    $('#eventName').val('');
                    $('#eventTrainer option:selected').removeAttr('selected');
                    $('#eventType option:selected').removeAttr('selected');


        });
    });

   </script>

At this point, I feel like I’ve tried it all, and I’m just hoping a fresh set of eyes will see what I missed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:14:28+00:00Added an answer on May 23, 2026 at 4:14 am

    Ok took a quick look it looks like you aren’t initializing the form with a blank form for the add action in the “select:” function of your full calendar:

    In your event click you are doing this:

    $('#formName').html(data);
    

    I don’t see where you are clearing that with a blank form for a new event. (might have just missed it there is a lot of code there)

    Let me know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on 2 .NET apps which must communicate with each other.
I'm currently working on an app and am having some architectural confusions. I'm implementing
I am currently working on an application which will audit computers, and one of
I'm currently working with a system that has inherited a DAL using .Net's strongly
I'm currently working on an application which writes data to the IsolatedStorageStore. As part
I'm currently working on a largely asynchronous application which uses TAP throughout. Every class
I'm still working on my zoomable node-graph project. I'm currently having problems with what
I am currently working on an Android app which uses Resteasy-mobile for the REST(JAXRS)
OK, I'm new to MVC and I'm working away on an issue which I
I am currently working on a way to load a bunch of different NPCs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.