Hello for everybody =) First sorry if my english isn't good (I don't speak english).
I'm trying to develop an application in PHP using CI (2.1.4) + Grocery Crud (1.4.1). While I was testing one of the forms, I've tried to insert a duplicate value in my DB (duplicate PK). Nothing happened on DB, but the insert message error didn't display. I obtain the same result if I try to violate other constraints (uniques, FK, etc).
I detected where is the problem, but I don't know how to fix it. On flexgrid-add.js, I insert a lot of js alerts to detect where the function breaks. On a particular line, the function exits and doesn't reach the line where the message error is displayed:
$(function(){
$('.ptogtitle').click(function(){
if($(this).hasClass('vsble'))
{
$(this).removeClass('vsble');
$('#main-table-box #crudForm').slideDown("slow");
}
else
{
$(this).addClass('vsble');
$('#main-table-box #crudForm').slideUp("slow");
}
});
var save_and_close = false;
$('#save-and-go-back-button').click(function(){
save_and_close = true;
$('#crudForm').trigger('submit');
});
$('#crudForm').submit(function(){
var my_crud_form = $(this);
$(this).ajaxSubmit({
url: validation_url,
dataType: 'json',
cache: 'false',
beforeSend: function(){
$("#FormLoading").show();
},
success: function(data){
$("#FormLoading").hide();
if(data.success)
{
$('#crudForm').ajaxSubmit({
dataType: 'text',
cache: 'false',
beforeSend: function(){
$("#FormLoading").show();
},
success: function(result){
$("#FormLoading").fadeOut("slow");
alert("Before parseJSON"); //It works fine
data = $.parseJSON(result); //Makes the function exit
alert("After parseJSON"); //Never gets here
if(data.success)
{
...
}
else
{
alert( message_insert_error ); //Never gets here
}
This error happens on Chrome (30.0.1599.101), Firefox (24.0) and IE (10.0.9200.16721). I didn't test this on Opera or Safari. Thanks in advance for any help. Regards.
