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 /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Checkbox in CMS

Go to End

4 Posts   812 Views


Community Member, 4 Posts

16 July 2013 at 12:54am

Edited: 16/07/2013 12:55am


this is my first post in SS forums. I'm quite new programmer and for SS as well.
I'm building my first web and i have some troubles with checkbox field. Everything looks good, but the problem is in CMS. If i check the value "DominaKeitimas" and do "save and publish" everything works except checkbox field in CMS. Somehow CMS do not save checked value in CMS, but in database and web it works perfectly. Search gives me everything i need and dataobject as well. So my question is: what did i do wrong and how to solute this issue?

some code...
class NTObjektas extends Page{
static $db = array( 'DominaKeitimas' => 'Boolean');
public static $has_one = array("Objects" =>"Object");
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Info', new CheckboxField('DominaKeitimas', 'Domina keitimas', 1));
/* some code */
return $fields;
class NTObjektas_Controller extends Page_Controller{

p.s. sorry for my broken english.


Community Member, 545 Posts

16 July 2013 at 3:28am

You're setting the value on the field which is overriding the set value on the CMS

$fields->addFieldToTab('Root.Info', new CheckboxField('DominaKeitimas', 'Domina keitimas', 1)); 
$fields->addFieldToTab('Root.Info', new CheckboxField('DominaKeitimas', 'Domina keitimas')); 


Community Member, 4 Posts

16 July 2013 at 4:13am

Edited: 16/07/2013 4:14am

sorry, but its not working....
and i don't know why... there are some problems with DropdownField...

$veiksmoTipas = new DropdownField('VeiksmoTipas', 'some text', array(
'Siulome' => 'Siūlome',
'Ieskome' => 'Ieškome',
'Vystomi' => 'Vystomi Objektai'
this one works perfectly, but another is the same problem as with the checkbox field....

$sandorioTipas = new DropdownField('SandorioTipas', 'some text', array(
'Nuoma' => 'Nuoma',
'Pardavimas' => 'Pardavimas'

$fields->addFieldToTab('Root.Info', $sandorioTipas);

values in the web and database are shown, but in CMS didn't saved.... strange


Community Member, 4 Posts

19 July 2013 at 8:30pm


i don't know what was wrong, but i changet my Variables names and all the things keep working :)