個人用ツール

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>

応用

コード

 

出力

 

変更履歴

ソースファイル

関連資料

類似の関数