Jump to content


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

validation required fields datatables flexigrid bootstrap

  • Please log in to reply
1 reply to this topic

#1 anna

anna

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 08 May 2016 - 11: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

Attached Thumbnails

  • Screenshot from 2016-05-09 01:51:56.png


#2 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

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:)







Also tagged with one or more of these keywords: validation, required fields, datatables, flexigrid, bootstrap

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users