Catch "save" event


#1

Hi,

I’m trying to, well, as the title states, catch the “save” event. I’m doing this since I do need to run functions (not just validations, but different behind-the-scenes checks too) prior to saving or not-saving an event.

I’m using the ‘onDataUpdate’ event handler, and I think I’m on the right track. Somehow though, it still saves the changes made to the event. Here’s my code:

[code]$$(‘scheduler’).data.attachEvent(‘onDataUpdate’, function (id, data) {

var currEvent = $$('scheduler').getItem(id);

if (currEvent.property == 'some property') {
	console.log('dont save');
	return false;
}
else {
	console.log('save');
	return true;
}

});
[/code]

What am I doing wrong?

Thanks,

Jim


#2

Hi,

There is not event that can block data saving. You can use validation rules:

scheduler.config.form_rules["property"] = function(value){ return value != 'some property'; };

Why this approach does not fit ?