⚠ 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 forum is read-only and soon will be archived. ⚠

Ana Letícia

Member Since 29 Apr 2014
Offline Last Active May 13 2014 07:25 PM

Topics I've Started

How to custom field on form view

29 April 2014 - 06:08 PM

Hi Everyone, I hope  you  understand me


So  I  have  a table about News and I change a column "publicate"(enum : y/n) with display_as "Status"(enum: Yes/No). It works on add form  and  edit form,  but  on view form it is showing "Status"(enum:y/n).  I've tried to use callback_field,callback_column and doesn't work. Someone can help me?


Here is my code:


            ->set_subject('Notícias do IBDFAM')
            ->display_as('publicar', 'Status')
            ->display_as('hora', 'Data')
            ->field_type('publicar','dropdown',array('s' => 'Ativo', 'n' => 'Inativo'))
            ->field_type('destaque','dropdown',array(0 => 'Não', 1 => 'Sim'))


    public function _status($value, $row)
        if($value == 's'){
            $value = 'Ativo';
         }elseif($value =='n'){
            $value =  'Inativo';
        return $value;