views:

245

answers:

2

I would like to be able to add my events to my mysql databse by clicking on the calendar day and inputting into a pop up window. I need to keep the fullcalendar interface but need to add to its functionality. I have been searching extensivly for this but I keep getting side tracked or going down blind alleys. A step by step tutorial would be greatly appreciated.

I am coding in PHP with MySQL database.

A: 

Adding events isn't part of the full calender API, but it's not necessary anyway.

Just create a form that adds a new record to the database. The next time you make the call to the DB to get all the events for the calendar, your new event will show up. If you want to do this via AJAX, then each event has an eventClick function that you can hook into.

Doozer1979
How does the eventClick help someone add an event via AJAX? Don't you have to have the event already to get an eventClick for it?
gidmanma
Well yeah, but the point i was making is that you don't need to hook into the fullcalendar API to add events. Just create a form to do it. Once the event is created it will then have all the properties
Doozer1979
A: 

I have not found a tutorial for this but after some digging around, this seems to be the expected process:

  1. Create the JavaScript functions necessary to display a Create Event form and post the data back to the server.
  2. Hook up the dayClick event to display your Create Event form. The dayClick event will give you what you need to prefill the date/time on your Create Event form. http://arshaw.com/fullcalendar/docs/mouse/dayClick/
  3. After you send your new event to the server you have a couple of options. You can either refresh all the events data from the server with rerenderEvents or manually add your new event to the current events in memory with renderEvent (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)

I'm getting ready to work on this tonight. If I hit any gotcha's I'll make sure to update my post.

gidmanma