Search
Handling Events
Introduction
General Information
What's New In This Release
Version History
Getting Started
Code Completion With VSDoc IntelliSense
Programming Interface Overview
Tutorials
Calendar View and Settings
Handling Events
CSS Styling
Serialization
Reference
Licensing
Online Resources
Technical Support
MindFusion Products

The MindFusion.Scheduling for JavaScript offers numerous events that let you control every action the user performs or is about to perform. In our sample we will demonstrate how you handle events by implementing a restriction: we will not allow the user to create any items in the first three days of each month.

We handle the itemCreating event and check the startTime and endTime of the item property of the ItemEventArgs class. If the days on which an appointment starts or ends are between 1st and 3rd, we cancel the event:

JavaScript Copy Code
calendar.itemCreating.addEventListener(validateCreateItem); function validateCreateItem (sender, args) { //checks if the date is ok if ((args.item.startTime.day >= 1 && args.item.startTime.day <= 3) || (args.item.endTime.day > 1 && args.item.endTime.day <= 3) ) { alert("Events cannot be scheduled during the first three days."); args.cancel = true; } }

Here is the result:

The schedule does not allow the user to create events at the beginning of the month.

The Events topic from the "API Overview" section gives details about the events that available in MindFusion.Scheduling for JavaScript. You can also check the Calendar class members list where most of the events are listed. The Schedule class members topic also lists some events raised by the calendar schedule object.