0

我需要一个包含一个文本区域和一个文本框的内联格式帽子。我决定使用以下代码为 Jeditable 编写一个自定义类型:

    $.editable.addInputType('edit_area', {
        element : function(settings, original) {
            var input = $('<textarea id=\"bio\">');               
            $(this).append(input);

            var source = $('<input type="text" id="source" />');
            $(this).append(source);

            var hidden = $('<input type="hidden" />');
            $(this).append(hidden);

            return(hidden);
        },
        submit: function (settings, original) {
            var value = $('#bio').val();

            $(':hidden', this).val(value);
        }
    });

    $('.edit_area').editable('/MyUrl/', {
        type      : 'edit_area',
        cancel    : 'Cancel',
        submit    : 'OK',
        submitdata : function(value, settings) {
            var source = $("#source").val();

            return {foo: source};
        }
    });

此代码有效,但是一旦将信息发布到服务器(服务器返回空结果),Jeditable 看起来就像 Jeditable 接受该空响应并在屏幕上使用它,导致编辑后的文本变为空白。我尝试返回编辑后的文本,在这种情况下代码有效,但我不想返回所有文本,除非我必须这样做。

有没有人见过这个问题?任何帮助表示赞赏。

谢谢

4

1 回答 1

0

I think it's not possible not to return the value in your server action. In the Jeditable documentation it's clearly stated that there are two parameters posted to the server: "id" and "value", and that the new displayed text is what the server returns.

于 2011-04-12T15:00:19.447 回答