如何在 RadScheduler 插入之前验证约会

发布于 2024-12-09 10:05:30 字数 1432 浏览 0 评论 0原文

我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

衣神在巴黎 2024-12-16 10:05:31

请查看 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文