I have a form that I want to use to get details to put in the google calendar.
If I add the alert just after I call calendarService.insertEntry - then the callback function runs, and the event is added to the calendar. When I remove the alert - then the callback function doesn't run, and the event is not added to the calendar. I'm quite confused. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/ > <title>Cougar Hockey</title> <script src="http://www.google.com/jsapi? key=ABQIAAAAA6DzGfhEBDw8LjaRYhKEtRQfEl70ACcujjWIYIFcJGGPKTxyEhTi-1l39D6Epnf61OZ0nudkRKLb6g" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ google.setOnLoadCallback(getMyFeed); google.load("gdata", "1"); var gSuccessful; function getMyFeed() { // Fill out var scope = 'http://www.google.com/calendar/feeds/'; if (!google.accounts.user.checkLogin(scope)) { google.accounts.user.login(); } else { } } function newEvent() { eventTitle = document.calendarEvent.eventTitle.value; eventDescription = document.calendarEvent.eventDescription.value; startTime = document.calendarEvent.eventStartTime.value; endTime = document.calendarEvent.eventEndTime.value; //createEvent(theTitle, theDetails, theStartTime, theEventTime); /* * Create a single event */ // Create the calendar service object var calendarService = new google.gdata.calendar.CalendarService ('GoogleInc-jsguide-1.0'); // The default "private/full" feed is used to insert event to the // primary calendar of the authenticated user var feedUri = 'http://www.google.com/calendar/feeds/default/private/ full'; // Create an instance of CalendarEventEntry representing the new event var entry = new google.gdata.calendar.CalendarEventEntry(); // Set the title of the event entry.setTitle(google.gdata.Text.create(eventTitle)); // Set the content of the event entry.setContent(google.gdata.Text.create(eventDescription)); // Create a When object that will be attached to the event var when = new google.gdata.When(); // Set the start and end time of the When object var startTime = google.gdata.DateTime.fromIso8601(startTime); var endTime = google.gdata.DateTime.fromIso8601(endTime); when.setStartTime(startTime); when.setEndTime(endTime); // Add the When object to the event entry.addTime(when); // The callback method that will be called after a successful insertion from insertEntry() var callback = function(result) { window.location = "successful.html"; } // Error handler will be invoked if there is an error from insertEntry() var handleError = function(error) { window.location = "error.html"; } // Submit the request using the calendar service object calendarService.insertEntry(feedUri, entry, callback, handleError, google.gdata.calendar.CalendarEventEntry); //If I add this alert, the event is added to the calendar //If I remove this alert, the is not added to the calendar alert("Thank you."); } //]]> </script> </head> <body> <div id="panel"/> <img src="news-header-tier2.jpg" /> <form name="calendarEvent" onsubmit="newEvent();"> <label for="eventTitle">Event Title:</label> <input type="text" name="eventTitle" /><br /> <label for="eventDescription">Event Description:</label> <input type="text" name="eventDescription" /><br /> <label for="eventStartTime">Event Start Time:</label> <input type="text" name="eventStartTime" /><br /> <label for="eventEndTime">Event End Time:</label> <input type="text" name="eventEndTime" /><br /> <input type="submit" value="Submit" /> </form> </body> </html> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
