jquery jeditable validation - 从显示的textarea获取值的问题

时间:2013-09-05 10:38:07

标签: jquery

我想验证datatable jeditable textarea中的输入(单击数据表单元格时出现)。当我尝试获取值并验证它时,即使输入一个数字,我也会得到未定义的值。我的代码是:

    $(".editable_textarea").editable(submitEdit, { 
                    indicator : "Saving...",
                    tooltip   : "Click to edit...",
                    style   : 'background-color:#ffffff;border-width:1px;border-style:solid;border-color:#cccccc;font-family:Arial,sans-serif;padding:2px',
                    name : "Editable.FieldName",
                    id   : "elementid",
                    type : "textarea", 
                    submit   : ' Save ',
                    cancel   : ' Cancel ',
                    onsubmit: function (content){
                        alert(content.current);// returns undefined
                        var input = $(content).find('input');
                        var original = input.val();
                        alert(original);// returns undefined
//validation is easy but the problem is to get a value to validate it
                    },
                    width: "100%"
                });


                function submitEdit(value, settings) { 
                   var edits = new Object();
                   var origvalue = this.revert;
                   var textbox = this;
                   var result = value;
                   edits[settings.name] = [value];

                   var servlet = '<%=request.getContextPath()%>'+ '/SettingServlet';
                   var ref = '?action=edit&' + textbox.id + '&o=' + encodeURI(origvalue) + '&v=' + encodeURI(value);

                   var returned = $.ajax({
                           url: servlet + ref, 
                           type: "POST",
                           data : edits,
                           dataType : "json",
                           complete : function (xhr, textStatus) 
                           {/* 
                               var response =  $.secureEvalJSON(xhr.responseText);
                               if (response.Message != "") 
                               {
                                   alert(Message);
                               }  */
                           }
                           });             
                   return(result);
                 }

0 个答案:

没有答案