ver4/関数リファレンス/BcForm/radio
提供: baserCMS公式ガイド
[このコンテンツは内容調整中です]
目次
説明
- ラジオウィジェットのセットを作成します。凡例とフィールドセットを作成します。
- デフォルトでは$optionsを使って制御する
使い方
$this->BcForm->radio( [$fieldName] , [$options] , [$attributes] )
パラメータ
- (string)$fieldName
- フィールド名
- (array)$options
- ラジオボタンの各要素を設定
- $optionsに配列の配列を代入して使う
- (array)$attributes
- select要素の属性配列 初期値: array()
戻り値
- (string)
- ラジオウィジェットのセット
用例
基本
コード
<?php $options = array( array('name' => 'United states', 'value' => 'US', 'title' => 'My title'), array('name' => 'Germany', 'value' => 'DE', 'class' => 'de-de', 'title' => 'Another title'), ); ?> <?php echo $this->BcForm->radio('test_radio' , $options,array('legend'=>'ラジオ')); ?>
出力
<fieldset> <legend>ラジオ</legend> <input type="hidden" name="data[BlogComment][test_radio]" id="BlogCommentTestRadio_" value=""/> <label for="BlogCommentTestRadio0"> <input type="radio" name="data[BlogComment][test_radio]" id="BlogCommentTestRadio0" value="US" title="My title" /> United states </label> <label for="BlogCommentTestRadio1"> <input type="radio" name="data[BlogComment][test_radio]" id="BlogCommentTestRadio1" value="DE" class="de-de" title="Another title" /> Germany </label> </fieldset>