\Phalcon\Tag - checked property problem

Hi, How do you handle checked option to <input type='checkbox' name='test' value='1' />

when i get value from database i tried to setup property checked by \Phalcon\Tag::setDefault to get <input type='checkbox' name='test' value='1' checked />

I did something like this RobotsController

   public function editAction()
   {
        $robots = Robots::findFirst("id = 'Android'");
        $this->view->setVar("robot_broken","data-not-checked");
        if($robots->broken == 1)
        {
            $this->view->setVar("robot_broken","checked");
        }
    }

in edit.phtml view i did ```php <div>Is robot broken?: <?php echo \Phalcon\Tag::checkField(array( "robotbroken", "value"=>1, $robotbroken => "checked" )) ?> </div> ```

This is my workaround If robot is broken then in checkbox is marked as checked="checked", when robot is not broken then checkbox is marked as data-not-checked="checked" :)

Maybe it help somebody, before it will be handle by framework. Maybe it could work in framework in this way, if not checked could be setup fake property data-fake-property='checked'



81.8k

This implementation is now fixed in 1.2.0