public function addField($label, $value, $checked = false, $meta = array())
    {
        $name = $this->getName();

        $objField = new GroupField($this->getRandomId($name), $name, $this->__type, $label, $value, $checked, $meta);
        $objField->setMeta("parent", $this, true);

        $this->__fields->addObject($objField);

        // *** Set the default value if "checked" is set.
		if ($checked) {
		    switch ($this->__type) {
		        case ValidForm::VFORM_CHECK_LIST:
		            $arrDefault = (is_array($this->__default)) ? $this->__default : array($this->__default);
		            $arrDefault[] = $value;

		            $this->__default = $arrDefault;

		            break;
		        default:
		            $this->__default = $value;
		    }
		}

        return $objField;
    }
public function addField($label, $value, $checked = false, $meta = array())
    {
        $name = $this->getName();

        $objField = new GroupField($this->getRandomId($name), $name, $this->__type, $label, $value, $checked, $meta);
        $objField->setMeta("parent", $this, true);

        $this->__fields->addObject($objField);

        // *** Set the default value if "checked" is set.
		if ($checked) {
		    switch ($this->__type) {
		        case ValidForm::VFORM_CHECK_LIST:
		            $arrDefault = (is_array($this->__default)) ? $this->__default : array($this->__default);
		            $arrDefault[] = $value;

		            $this->__default = $arrDefault;

		            break;
		        default:
		            $this->__default = $value;
		    }
		}

        return $objField;
    }
public function addField ( $ label , $ value , $ checked = false , $ meta = array ( ) ) { $ name = $ this -> getName ( ) ; $ objField = new GroupField ( $ this -> getRandomId ( $ name ) , $ name , $ this -> __type , $ label , $ value , $ checked , $ meta ) ; $ objField -> setMeta ( "parent" , $ this , true ) ; $ this -> __fields -> addObject ( $ objField ) ; // *** Set the default value if "checked" is set. if ( $ checked ) { switch ( $ this -> __type ) { case ValidForm :: VFORM_CHECK_LIST : $ arrDefault = ( is_array ( $ this -> __default ) ) ? $ this -> __default : array ( $ this -> __default ) ; $ arrDefault [ ] = $ value ; $ this -> __default = $ arrDefault ; break ; default : $ this -> __default = $ value ; } } return $ objField ; }
Add either a radio button or checkbox to the group

@param string $label The label
@param string $value The value
@param boolean $checked Set to true if this item should be checked / selected by default
@param array $meta The meta array

@return \ValidFormBuilder\GroupField
Add either a radio button or checkbox to the group