In case you've missed it, you are looking at an older version of the website. Checkout our latest version, we promise you will love it 😍

Set Validation Rules

It works the same as codeigniter's rules .
function example_set_rules() {
 
    $crud = new grocery_CRUD();
 
    $crud->set_table('products');
    $crud->columns('productName','buyPrice');
 
    $crud->set_rules('buyPrice','buy Price','numeric');
    $crud->set_rules('quantityInStock','Quantity In Stock','integer');
 
    $output = $crud->render();
 
    $this->_example_output($output);
}    
Note: The below example is an iframe so it might appeared with a scroll bar. If you like you can view the example on a new tab

For more about the function set_rules you can find here