⚠ 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 is an archived forum. ⚠

  •     

profile picture

field_type true_false on read state



Juliano Martins
  • profile picture
  • Member

Posted 28 October 2013 - 18:25 PM

I'm trying to show a boolean field in the read state, but so far without success.
 
See what I'm trying:
 
 
$crud->field_type('ativo', 'true_false', array('1' => 'Sim', '0' => 'Não'));

This field in my table is:

`ativo` TINYINT(1) NOT NULL DEFAULT '1',

I use: GC stable version 1.4.1 and CI 2.1.3

 

Any suggestions?


edramirez
  • profile picture
  • Member

Posted 10 November 2013 - 15:11 PM

The correct way to do it is like so:

 

$crud->field_type('ativo','dropdown', array('1' => 'Sim', '0' => 'Nao'));

 

Hope this helps.

 

Regards,

 

Ed Ramirez

 

P.S. Don't forget to click the Like button!  :)


Juliano Martins
  • profile picture
  • Member

Posted 17 November 2013 - 13:28 PM

I try this, but dont work in READ state


Robert
  • profile picture
  • Member

Posted 20 November 2013 - 14:09 PM

Read state is not 100% completed .. using field_type will not show the name in read you can use 

$crud->field_type('ativo','dropdown', array('Sim' => 'Sim', 'Nao' => 'Nao'));

this will save sim and nao into the table (if you change the column format ) and work in read... this way you can use search on the column to since using (1,2) will not work.


guilhrme
  • profile picture
  • Member

Posted 29 February 2016 - 01:25 AM

The correct way to do it is like so:

 

$crud->field_type('ativo','dropdown', array('1' => 'Sim', '0' => 'Nao'));

 

Hope this helps.

 

Regards,

 

Ed Ramirez

 

P.S. Don't forget to click the Like button!  :)

 

Very nice, Worked for me!


Amit Shah
  • profile picture
  • Member

Posted 29 February 2016 - 14:36 PM

Hi Juliano,

 

That may have worked for you but there is a prominent solution to the same..

Follow the instructions / updates shared on the following url

http://grocerycrud.amitsgarage.com/bwl-knowledge-base/enhance-the-read-view/