can we set html attributes in phalcon forms.

can we set html stttibutes in phalcon forms..... example.... i want to set

<div class="icheckbox_flat-green checked" style="position: relative;" aria-checked="true" aria-disabled="false">
    <ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%;margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 0px none; opacity: 0;">

to all the checkboxes in the form itself...... can i do it in this way(bysetting them in the forms ).???? Please help!!!

  new Checkbox("my_name", [ 
      "class" => "myClass",
      style = "margin-top: 10px;" ,
      "myCustomProperty" => true 


edited Nov '16

thanks for the reply!!! work is half done.... i want to run an extra <div> for all the checkboxes... Can you help?

edited Nov '16

you cant do that in the php.

but u can wrap them with that div in phtml, volt file ?

or extend the checkbox class and write your own render function for them

edited Nov '16

How can i extend the checkbox class. Can you give an example?

edited Nov '16

use Phalcon\Forms\Element;
use Phalcon\Forms\ElementInterface;

class myCheckbox extends Element implements ElementInterface {

    public function render($attributes = null){

        return "<div class="whatever"><input type checkbox name .. > </div> ...";

source here: