⚠ 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 is an archived forum. ⚠

  •     

profile picture

Validation ($crud->required_fields) is not working (datatables, flexigrid,bootstrap)



anna
  • profile picture
  • Member

Posted 08 May 2016 - 23:04 PM

Hi all,

 

I am new to GrooceryCrud and I need your help. I have installed GC successfully and testing the basic functionality with my database tables.

 

I have a problem when adding a new entry. The form validation seems to not work. I have tried all 3 themes (datatables, flexigrid, bootstrap) and I encounter the same

problem. When editing, the validation works for flexigrid and bootstrap, but not for datatables theme.

 

I have tried just the $crud->required_fields, and when the required field is empty, NO red box appears, NO message appears. Just the page remains with the blank text box.

At the same time, I noticed the following error that appears in the Console (Developer tools of Firefox)

 

ReferenceError: form_error_message is not defined               flexigrid-add.js:84:7

.success()                                                   flexigrid-add.js:84
a.fn.ajaxSubmit/b.success()                       jquery.form.min.js:7
m.Callbacks/j()                                           jquery-1.11.1.min.js:2
m.Callbacks/k.fireWith()                              jquery-1.11.1.min.js:2
x()                                                              jquery-1.11.1.min.js:4
.send/b()                                                jquery-1.11.1.min.js:4
 

 

(See also attached file)

 

I have tried to use also the:

 

      $crud->set_rules('groupName','Group Name','required');

but no difference,

 

Below is the Controller function:

 

----------

    public function citrusGroups()
    {
        try{
            $crud = new grocery_CRUD();

            $crud->set_theme('datatables');
            $crud->set_table('V2_CitrusGroups');
            $crud->set_subject('Citrus Group');
            $crud->required_fields('groupName');
            $crud->set_rules('groupName','Group Name','required');
            $crud->columns('groupName','notes','webNotes');
            $crud->display_as('groupName','Group Name');
      $crud->display_as('notes','Notes');
      $crud->display_as('webNotes','Web Notes');


            $output = $crud->render();

            $this->_example_output($output);

        }catch(Exception $e){
            show_error($e->getMessage().' --- '.$e->getTraceAsString());
        }
    }

----------

 

I would really appreciate any help/comment. I want so much to use the GC but this issue is an obstacle for me.

 

Best regards,

Anna


Amit Shah
  • profile picture
  • Member

Posted 12 May 2016 - 10:29 AM

i will suggest / recommend - check the same into network calls. Check what is the output - there surely seems to be some warnings / notice being printed out.

You can set the mode to developers mode and that should disappear .. unless there is some error in the same.

 

Happy GCing:)