⚠ 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 gives error when creating new post



muuucho

muuucho
  • profile picture
  • Member

Posted 22 February 2016 - 09:59 AM

    public function mymembers()
            {
$crud = new grocery_CRUD();
                        //$crud->set_theme('bootstrap');
                        $crud->set_subject('Medlemmar');//Header etc
                        $crud->columns('name', 'age', 'born', 'userInterestId');//name of the columns
                        $crud->fields('name', 'age', 'born', 'userInterestId');//name of the columns
                        $crud->set_relation('userInterestId', 'interests', 'interestName');//the relation to another table
$crud->required_fields('age','born');//validation
                        
$output = $crud->render();
$this->_example_output($output);
            }

muuucho

muuucho
  • profile picture
  • Member

Posted 22 February 2016 - 12:08 PM

What I mean is that when I add the validation row to the code an error is thrown when I try to create a new post. Without that validation row the post i inserted.


muuucho

muuucho
  • profile picture
  • Member

Posted 23 February 2016 - 16:04 PM

The error is displayed by $lang['insert_error']. That indicates that the validation doesn't stop the scritpt from making an insert attempt. Huh?


muuucho

muuucho
  • profile picture
  • Member

Posted 24 February 2016 - 07:18 AM

I have the same problem when i run the example crud "Offices" when I leave out the office name in the form and submit it.


muuucho

muuucho
  • profile picture
  • Member

Posted 24 February 2016 - 19:13 PM

I have created a new file in assets/grocery_crud/language (containtng a new language ofcurse) and set $config['grocery_crud_default_language'] to that language and that causes the problem!

If I switch back to call any existing language file  the script works as expected. So does anybody knows how to implement a new language apart from just creating the language file?


muuucho

muuucho
  • profile picture
  • Member

Posted 24 February 2016 - 20:52 PM

I have now found a file in system/language/english and I have copied that map to a new language map. After that I changed $config['language'] in application/config/config.php to that langugae and viola!