Reputation: 1776
I am wondering how to set the checkbox value of a zend form element to 'checked'? I went in my Debug-11-condition so I would expect to see an active arrow in my box. Unfortunately the box remains empty.
$room = $this->getRoomTable()->getRoom($roomId);
$roomForm->bind($room);
$lightOneValue = $room->getLighsone();
if ($lightOneValue == "100"){
Debug::dump('11');
$roomForm->get('lightone')->setChecked(true);
} else { ...
Upvotes: 1
Views: 5248
Reputation: 26
$this->formCheckbox instead of $this->formInput was the point in my case, as Nykac pointed out above.
Upvotes: 0
Reputation: 1101
Change true as 1 dude,
$roomForm->get('lightone')->setValue(1);
Upvotes: 3