Question

I am using editable for my datepicker. I am trying to have some confirmation in my validation but it does not work. Is there something wrong? Here is my code:

$('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();
    }
  });
Was it helpful?

Solution

Your usage of method confirm is wrong, you can read about that method here

You can used code like this:

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

EDIT Using bootbox use this code

bootbox.confirm("Are you sure?", function(result) {
 Example.show("Confirm result: "+result);
}); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top