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 😍

callback_before_insert example

In this example try to add an empty postal code.
function example_callback_before_insert(){
    $crud = new grocery_CRUD();
    $crud->callback_before_insert(function ($post_array)  {
        if (empty($post_array['postalCode'])) {
            $post_array['postalCode'] = 'Not U.S.';
        return $post_array;
    $output = $crud->render();
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