我有CakePHP的代碼一樣修復
<?php foreach ($viewfields as $r):
if($r['Attribute']['type']=='radio')
{
>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function($){
$("#"+<?=$r['Attribute']['id'];?>).each(function() {
type= "<?=$r['Attribute']['type'];?>";
attribute_id="<?=$r['Attribute']['id'];?>";
if(type=="radio")
{
var ht = $.ajax({
type: "GET",
url: "http://localhost/FormBuilder/index.php/forms/viewChoices/"+attribute_id,
async: false
}).responseText;
var myObject = eval('(' + ht + ')');
var data = myObject;var j=0;
$.map(data.choices, function(i){ j++;
alert(i.choice);
return i.choice;});
}//type==radio
});//each
});//jquery
</script>
<?php
echo $form->input('field', array(
'type' => 'radio','legend'=>$r['Attribute']['label'],
'separator' => '--separator--',
'options' => array()
));
}//if php type == radio
endforeach; ?>
警報(i.choice)在CakePHP的表單字段的選項類型單選按鈕;?/通知我的選擇,爲標籤性別爲男,女 和標籤「經驗yes和no ..
如何放置男性和女性在‘選項’=>陣列()..please建議我...
duplicate:http://stackoverflow.com/questions/1393512/querying-inside-form-input-array – deizel 2009-09-10 13:06:14