Php 依亲投递名单

Php 依亲投递名单,php,ajax,drop-down-menu,yii,Php,Ajax,Drop Down Menu,Yii,我需要用yii创建依赖的dropDownLists。因此,我在控制器中创建了一个视图和一个动作,如下所示: 视图 <?php echo "<div class='row'>"; echo $form->labelEx($model, 'id_structure'); echo $form->dropDownList($model, 'id_structure', GxHtml::listDataEx(StructureInformation::model()->

我需要用yii创建依赖的dropDownLists。因此,我在控制器中创建了一个视图和一个动作,如下所示:

视图

<?php
echo "<div class='row'>";
echo $form->labelEx($model, 'id_structure');
echo $form->dropDownList($model, 'id_structure', GxHtml::listDataEx(StructureInformation::model()->findAllAttributes()), 
array('ajax' => array('type' => 'POST', 
    'url' => CController::createUrl('InfoComplementAAjouter/fillTypeList'), 
    'update' => '#typeDonnee', 
    'data' => array('id_structure' => 'js:this.value'))
));
echo $form->error($model, 'id_structure');
echo '</div>';
echo "<div class='row'>";
echo $form->labelEx($model, 'type');
echo $form->dropDownList($model, 'type', array(), array('prompt' => 'Sélectionner', 'id' => 'typeDonnee'));
echo $form->error($model, 'type');
echo '<div>';
?>
我注意到行动没有执行。我不明白为什么。 有人能帮我解决这个问题吗?

我刚才看到一个打字错误:

'upedate' => '#typeDonnee', 
应该是
'update'

试着先把它修好

编辑:

您有更多的小错误/打字错误

echo $form->dropDownList($model, 'id_structure', GxHtml::listDataEx(StructureInformation::model()->findAllAttributes(), 
array('ajax' => array('type' => 'POST', 
    'url' => CController::createUrl('InfoComplementAAjouter/fillTypeList'), 
    'update' => '#typeDonnee', 
    'data' => array('id_structure' => 'js:this.value'))
));
在这里你需要关闭括号

=====================================================

StructureInformation::model()->findAllAttributes()
CActiveRecord
也许您想要使用
findAllByAttributes()
,但是您需要传递一些属性。如果这是您的自定义方法,那么您应该解释它是如何工作的,或者粘贴代码

编辑2:

尝试按以下方式访问帖子:

$_POST['id_structure']
我想你用那种结构发邮件


复制你的情况对我来说不是那么容易,所以我只是在暗中拍摄

谢谢,但这并不能解决问题。我必须相应地编辑我的帖子。好的,好的!在写这篇文章时,我犯了一些错误,因为我没有复制和粘贴。
findAllAttributes()
是一种
GxActiveRecord
的方法,因为我正在使用Gii扩展生成我的模型、控制器和视图。不,任何错误。即使在第一个下拉列表中选择了另一个值,第二个下拉列表仍为空。
$_POST['InfoComplementAAjouter']['id_structure']
$_POST['id_structure']