JEditable custom types causes edit to go blank
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.
精彩评论