⚠ In case you've missed it we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠

message_insert_error doesn't display when there's a db error

message error db

  • Please log in to reply
1 reply to this topic

#1 hipo_loco



  • Members
  • Pip
  • 1 posts

Posted 03 November 2013 - 12:01 AM

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:

            $('#main-table-box #crudForm').slideDown("slow");
            $('#main-table-box #crudForm').slideUp("slow");
    var save_and_close = false;

        save_and_close = true;


        var my_crud_form = $(this);

            url: validation_url,
            dataType: 'json',
            cache: 'false',
            beforeSend: function(){
                success: function(data){
                            dataType: 'text',
                            cache: 'false',
                            beforeSend: function(){
                            success: function(result){
                                alert("Before parseJSON"); //It works fine
                                data = $.parseJSON(result); //Makes the function exit
                                alert("After parseJSON"); //Never gets here
                                    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.

#2 edramirez


    Advanced Member

  • Members
  • PipPipPip
  • 63 posts

Posted 11 November 2013 - 05:21 PM

First of all, thanks for the reporting of the problem.


But second, don't let that problem stop you from using grocerycrud.


When I develop applications, I use set_relation for to ensure that the foreign key constraints are met.


When the users ask me why the add or edit operation doesn't proceed, I tell them that they entered an invalid value instead of selecting the correct value from the dropdown :angry: . I also tell them also that they might be re-encoding data that has been encoded before :o . Then I continue to use grocerycrud. I'm not going to wait until Johnny fixes all of the bugs before I start using the software.  B)


User: Sir, when I tried to save the data I entered, the program stopped and did not proceed.  :(

Me: Well, that's what you get for entering wrong data or retyping the same data.  <_<

User:Ok I'll fix it.  :wacko:


Just wanted to emphasize that software products will always have bugs, but they aren't going to stop us, right?  :D





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users