An extension to the popular CodeIgniter library Grocery Crud that allows you to add class name to fields and automatically adds required attribute and class names
- string
- integer
- true_false
- text
- datetime
- password
- date
- dropdown
- enum
- set
- multiselect
- relation
- relation_n_n
- Add the the extension file to your application -> libraries folder.
- Load the main crud library and the extension and instantiate the extension class. See below. Remember to instantiate the extension class and not the original grocery crud class.
$this->load->library('grocery_CRUD');
$this->load->library('extension_grocery_CRUD');
$this->crud = new Extension_grocery_CRUD();
This extensions adds the HTML5 required attribute as well as a required class name to any fields that are added to the grocery_CRUD->required_fields element.
It also adds a public method classes so that you can add class names to your field. It is nondestructive, so any class names already there by the grocer crud framework are preserved and added to the list of classnames.
Usage example:
$this->load->library('grocery_CRUD');
$this->load->library('extension_grocery_CRUD');
$this->crud = new Extension_grocery_CRUD();
$this->crud->classes('field_name', 'class1 class2 class3');