在可编辑不工作的验证中添加确认

Adding confirmation inside validation of editable not working

本文关键字:验证 添加 确认 工作 编辑      更新时间:2023-09-26

我的日期选择器使用可编辑。我试图在我的验证中得到一些确认,但它不起作用。有什么问题吗?这是我的代码:

$('inputdate').editable({
    type: 'date',
    params: function(params){
        params.dateVal = dateVal;
        return params;
    },
     validate : function(value){
        var message = null;
        confirm("Are you sure you sure?",  
         function(result) {             
           if(result){
           //ajax call here
           }
           });
        });
        return message;
        }
        else return 'Notif';
    },
    url: url2,
    success: function(response){
        location.reload();
    }
  });

您对方法的使用确认是错误的,您可以在这里阅读有关该方法的

你可以使用这样的代码:

if (confirm('question')){
 console.log('yes')
}
else{
 console.log('no')
}

编辑使用引导框使用此代码

bootbox.confirm("Are you sure?", function(result) {
 Example.show("Confirm result: "+result);
});