Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Insert checkboxField in DataObjectManager


2 Posts   265 Views


20 November 2012 at 9:15pm Community Member, 8 Posts

I have a question!Example:In my table,the status column have boolean style so i want to display it on DataObjectManager as CheckboxField
If status is true,the checkboxfield will check else uncheck
How i display the boolean column as checkboxfield in DataObjectManager or ComplexTableField?


20 November 2012 at 10:48pm Community Member, 66 Posts

I implemented this in the following way with DataObjectManager.

In your Dataobject $db array

static $db = array ('Status' = 'Boolean');

Then in the getCMSFields method

$statusField = new CheckboxField('Status', 'Current Status');

It's that simple. Once a boolean value is saved in the Database for Status then the checkbox will be either checked or not checked. You may want to put some validation in place if this data is coming from somewhere other than your CMS, an API for example.