Thanks for the answers.
On 1) I have the following code.
The rational behind this was that I wanted the JSON start / end dates to be in the form returned on the ‘load’ eg. start_date:“2009-7-1 6:00” and I did not want the extra internal date being sent in the JSON.
I thought in answer to another forum question I was told this editing was ok but perhaps I have misunderstood.
So how would this be achieved without affecting the ‘event’ ?
Note: I am new to Javascript so I apologise if this is obvious.
scheduler.attachEvent("onEventAdded", function(event_id,event_object){
sendaddevent(event_id,’/AddEvent.json?userid=${user.id}');
return true;
});
function sendaddevent(id,url){
convert_date_time = scheduler.date.date_to_str("%Y-%m-%d %H:%i");
var req = new XMLHttpRequest();
req.open('POST', url , false);
req.setRequestHeader("Content-Type","application/json");
req.setRequestHeader("Accept","application/json");
var event = scheduler.getEvent(id);
event.start_date = convert_date_time(event.start_date);
event.end_date = convert_date_time(event.end_date);
delete event._inner;
delete event._sday;
delete event._timed;
delete event._sorder;
delete event._count;
var string = JSON.stringify(event);
req.send(string);
var responseString = req.responseText;
var newEvent = JSON.parse(responseString);
scheduler.changeEventId(event.id,newEvent.id);
return true;
};
On 2) Are you talking about something unique for each request ?
For example I have:
scheduler.load(“/ListEvents.json?userid=${user.id}","json");
but this would be the same for each request for that user.
Is there a way to get the Javascript to generate this unique number across requests ?
On 3) my website is not on the public internet at present – I will see if when I fix the above it is solved.
- I have also notice another issue.
In firefox if I take an event and ‘edit’ it – then ‘delete’ it – ‘onEventChanged’ is called not on ‘onBeforeEventDelete’ so I do my change logic to the server not my ‘delete’ logic.
Sorry I have so many questions and thanks for any help provided.