如何在 RadScheduler 插入之前验证约会
我的 RadScheduler 有问题。我需要在插入表单打开之前验证双击的时间段是否可用。我使用高级插入形式。不幸的是,它没有 OnAppointmentInserting 或类似的事件。我发现 OnClientAppointmentInserting 事件,我可以使用它进行验证,但如果验证正确,我无法继续插入表单。按照我用于客户端验证的代码,但验证后无法显示插入表单:
function beforeInserting(s, e) {
var url = '';
var requestUrl = window.location.href.toLowerCase();
if (requestUrl.indexOf('/views/') != -1)
url = requestUrl.substring(0, requestUrl.indexOf('/views/')) + '/jobservice.svc/IsTimeAvailable?userId=0';
e.set_cancel(true);
var app = e.get_targetSlot();
$.ajax({
url: url,
accepts: 'application/json, text/javascript, */*',
cache: false,
success: function (r) {
if (r != '') {
alert(r);
return;
}
else {
var scheduler = $find("<%= rdJobScheduler.ClientID %>");
var newApp = new Telerik.Web.UI.SchedulerAppointment();
newApp.set_start(app.get_startTime());
newApp.set_end(app.get_endTime());
// This is not working properly it just send OnInserted event to server
// scheduler.insertAppointment(newApp);
}
},
error: function (err, text, xhr) {
alert(text);
}
});
}
I have a problem with RadScheduler. I need to validate double clicked time slot for availability before insert form opens. I using advanced insert form. Unfortunately its no OnAppointmentInserting or like event like this. I found OnClientAppointmentInserting event, and i can use it for validation, but i can not continue to insert form if validation is correct. Following the code i use for client side validation, but its no way to show insert form after validation:
function beforeInserting(s, e) {
var url = '';
var requestUrl = window.location.href.toLowerCase();
if (requestUrl.indexOf('/views/') != -1)
url = requestUrl.substring(0, requestUrl.indexOf('/views/')) + '/jobservice.svc/IsTimeAvailable?userId=0';
e.set_cancel(true);
var app = e.get_targetSlot();
$.ajax({
url: url,
accepts: 'application/json, text/javascript, */*',
cache: false,
success: function (r) {
if (r != '') {
alert(r);
return;
}
else {
var scheduler = $find("<%= rdJobScheduler.ClientID %>");
var newApp = new Telerik.Web.UI.SchedulerAppointment();
newApp.set_start(app.get_startTime());
newApp.set_end(app.get_endTime());
// This is not working properly it just send OnInserted event to server
// scheduler.insertAppointment(newApp);
}
},
error: function (err, text, xhr) {
alert(text);
}
});
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请查看 Telerik 的这篇知识库文章,了解如何防止插入约会。在这种情况下,仅当约会主题为空时 - 您无法插入约会。您可以使用自己的验证来代替。
Please take a look at this Knowledge Base article of Telerik to see how to prevent inserting of appointment. In their case only if the subject of the appointment is empty - you cannot insert the appointment. You can use your own validation instead.