メモ
$("#XXX").show(); → 表示
$("#XXX").hide(); → 非表示
jquery
*********
<script type="text/javascript">
$(function(){
//radioボタンチェンジ
$("input[name='data[Menu][item]']:radio" ).change(function() {
displayVals();
});
$(window).load(function () { displayVals();});
function displayVals() {
//var checkNum = $( this ).val();
var checkNum = $("input[name='data[Menu][item]']:checked" ).val()
if (checkNum == 0) {
//選択
$("#select").show();
$("#num").hide();
} else if (checkNum == 1) {
//数値
$("#select").hide();
$("#num").show();
}
}
});
</script>
----------------------------------------------------
radio
**********
<label>選択</label>
<div class="controls">
<?php echo $this->BootstrapForm->input('menu.num_select_flag',array('type' => 'radio', 'label' => false, 'options' => array( '0'=>'選択 ', '1'=>'数値 '), 'legend' => false, 'value' => $input_type)); ?>
</div>
<div id = "select">
<div id = "select_list" class="control-group">
<label>メニューリスト</label>
<div class="controls">
<?php echo $form->input('menu.select_list', array('type' => 'text', 'label' => false, 'value' => $menu_list)); ?>
</div>
</div>
</div>
<div id = "num">
<div id ="price" class="control-group">
<label>価格</label>
<div class="controls">
<?php echo $form->input('menu.price', array('type' => 'text', 'label' => false, 'value' => $price)); ?>
</div>
</div>
</div>