Jump to content

[ANSWERED] Adding extra field that doesn't exist in form at the callback_insert or callback_update doesn't work

  • Please log in to reply
1 reply to this topic

#1 web-johnny


    grocery CRUD Author

  • Administrators
  • 1,144 posts
  • LocationLondon

Posted 02 May 2012 - 06:02 AM

Well there is a solution for this.
That's why I created the type "invisible" field. So for example if you have:


and :

function test_callback($post_array){
$post_array['field4'] = 'test';
return $post_array;

This will NOT works unless you add the invisible field so you have to do it like this:


So this WILL WORK as you expected and without showing the field "field4" in the form.

The "invisible" field is made for this exact reason. I know that it is undocumented that's why I add it here.
Posted Image

#2 cgomez



  • Members
  • Pip
  • 1 posts

Posted 21 November 2013 - 04:39 PM

Please you can help me.

I want to insert into the field ¨codigo¨  the concatenated values ​​of the month  and year is possible

                         $this->grocery_crud->display_as('PlanConsumoActivo','Consumo Activo');
                   $this->grocery_crud->display_as('PlanConsumoReactivo','Consumo Reactivo');
                  $this->grocery_crud->display_as('MaximaDemandaPlan','Maxima Demanada');
                        $this->grocery_crud->display_as('idEntidad','Nombre de la Entidad');
$this->grocery_crud->callback_before_insert(array ($this,'generar_codigo'));
        $output = $this->grocery_crud->render();



and the callaback function is :

    function generar_codigo($post_array){
            $f=  $post_array['Nombre'];
           /* $a=$pos_array['Año'];*/
          //  $con=$f.$a;
          return $post_array;

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users