开发者

JEditable custom types causes edit to go blank

开发者 https://www.devze.com 2023-02-04 15:16 出处:网络
I need an inline format hat consists of one text area and one text box. I decided to write a custom type for Jeditable using the following code:

I need an inline format hat consists of one text area and one text box. I decided to write a custom type for Jeditable using the following code:

    $.editable.addInputType('edit_area', {
        element : function(settings, original) {
            var i开发者_C百科nput = $('<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};
        }
    });

This code works BUT once the information is posted to the server (server returns an empty result) it looks like Jeditable takes that empty response and uses it on the screen which causes the edited text to go blank. I tried returning the edited text in which case the code works but I don't want to be returning all that text unless I have to.

Has anyone seen this issue before? Any help is appreciated.

Thanks


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消