剑道表单提交功能未触发

时间:2021-01-07 20:33:05

标签: javascript kendo-ui kendo-grid

我对剑道很陌生,所以问愚蠢的问题是我的事。我已将表单添加到网格中,以便用户可以向对话添加新评论。

在前端,会出现一个提交按钮。不幸的是,当我点击按钮时什么也没有发生。清除按钮有一个警报,该警报会毫无问题地弹出。只是提交按钮不起作用。有没有人看到什么明显的东西?

$("<div/>").appendTo(e.detailCell).kendoForm({
    orientation: "vertical",
    formData: {
        comment: "enter text here"            
    },
    items: [{
        type: "group",
        label: "Add Comment",
        items: [{ 
                  field: "Comment", 
                  label: "Comment:", 
                  width: "85%", 
                  validation: { required: true } 
        }]
    }],                         
    submit: function(e) {
        alert("submit function");
        e.preventDefault();                             
        //var newComment = this.get("Comment");                              
        $.ajax({
            url: "/acme/common/submitFeedbackDetail.action?feedbackId=100&feedbackDetail=" + newComment,
            type : "GET",
            cache : false,
            contentType : "text/plain",
            datatype : "text",
            success : function() {
                alert("comment added");
            },
            error: function() {
                alert("comment failed");
            }
        });                                                                                                                            
    },
    clear: function(e) {
        alert("clear function");
    }
});

1 个答案:

答案 0 :(得分:0)

您使用 kendoForm() jquery 插件转换的元素必须是表单元素。否则你实际上不会得到一个 html 表单,这就是提交不起作用的原因。试试这个:

$("<form></form>").appendTo(e.detailCell).kendoForm({

https://docs.telerik.com/kendo-ui/controls/layout/form/overview

相关问题