Home Unanswered Active Tags New Question

Testing and message for attempt to create new event before current time and date

I want to generate a popup (Javascript alert) that tells someone that they are attempting to set an event prior to the current time and date.

Asked by JC 10 months ago.
Replies

It depends on how you are creating a new event. If it's directly on TimeRangeSelected it could look like this:

TimeRangeSelectedHandling="JavaScript"
TimeRangeSelectedJavaScript="check(start, end, resource)"
<script style="text/javascript">
function check(start, end, resource) {
  var now = new DayPilot.Date();
  // var today = now.getDatePart();
  
  if (end.getTime() < now.getTime()) {
    if (!(confirm('Are you sure that you want to create an event in the past?')) {
      return;
    }
  }
  dpc.timeRangeSelected(start, end, resource);
}
</script>
Answer posted by Dan Letecky [DayPilot] 10 months ago.

I am double clicking a free area. As such, there is no start or end

Comment posted by JC 10 months ago.

The double click event is handled by TimeRangeDoubleClick but otherwise it's the same. The start and end variables will hold the cell start and end, respectively.

Comment posted by Dan Letecky [DayPilot] 10 months ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java