如何检索在yii
框架中使用 Javascript 动态填充数据的值?当我发布数据时,它会将数据库插入为null
在视野中
<ul class="birthday">
<li><?php echo $form->dropDownList($model, 'otherdate',array());?></li>
<li><?php echo $form->dropDownList($model, 'othermonth',array());?></li>
<li><?php echo $form->dropDownList($model, 'otheryear',array());?></li>
<script type="text/javascript">
date_populate("EmailForm_otherdate", "EmailForm_othermonth", "EmailForm_otheryear");
</script>
</ul>
在控制器中
$model = new EmailForm;
if (isset($_POST['EmailForm'])) {
$model->attributes = $_POST['EmailForm'];
echo $model->otherdate; //value null
}