checkbox() 공개 메소드

MODIFIED 2008/10/24 egashira hiddenタグを出力しないオプションを追加 ### Options: - value - the value of the checkbox - checked - boolean indicate that this checkbox is checked. - hiddenField - boolean to indicate if you want the results of checkbox() to include a hidden input with a value of ''. - disabled - create a disabled input. - default - Set the default value for the checkbox. This allows you to start checkboxes as checked, without having to check the POST data. A matching POST data value, will overwrite the default value.
public checkbox ( string $fieldName, array $options = [] ) : string
$fieldName string Name of a field, like this "Modelname.fieldname"
$options array Array of HTML attributes.
리턴 string An HTML text input element.
예제 #1
0
 /**
  * チェックボックスを表示する
  * 
  * @param string $fieldName フィールド文字列
  * @param array $attributes html属性
  * @return string htmlタグ
  * @access public
  */
 public function checkbox($fieldName, $attributes = array())
 {
     if ($this->freezed) {
         $label = '';
         if (isset($attributes['label'])) {
             $label = $attributes['label'];
         }
         $options = array(0 => '', 1 => $label);
         return $this->freezeControll($fieldName, $options, $attributes);
     } else {
         return parent::checkbox($fieldName, $attributes);
     }
 }
예제 #2
0
 /**
  * チェックボックスを表示する
  * 
  * @param string $fieldName フィールド文字列
  * @param title $title タイトル
  * @param array $attributes html属性
  * @return string htmlタグ
  * @access public
  */
 function checkbox($fieldName, $title, $attributes = array())
 {
     if ($this->freezed) {
         $options = array(0 => '', 1 => $title);
         return $this->freezeControll($fieldName, $options, $attributes);
     } else {
         return parent::checkbox($fieldName, $attributes);
     }
 }