我有两个下拉列表和一个文本字段。我想将它们的值加在一起并使用 Yii 在另一个文本字段中显示结果。在 _form 我有这个。
<tr>
<td><?php echo $form->labelEx($model,'typeofpaper'); ?></td>
<td><?php $data = CHtml::listData(PaperType::model()->findAll(),'id','title');
if(isset($_REQUEST['id']))
{
$sel = $_REQUEST['id'];
} else {
$sel ='';
}
echo $form->dropDownList($model, 'typeofpaper', $data, array('prompt'=>'Type of Paper','options'=>array($sel=>array('selected'=>true))));
?>
<?php echo $form->error($model,'typeofpaper'); ?></td>
</tr>
<tr>
<td><?php echo $form->labelEx($model,'deadline'); ?></td>
<td><?php echo $form->dropDownList($model,'deadline',
array('3hrs'=> '3 hrs', '6hrs'=>'6 hrs', '12hrs'=>'12 hrs', '24hrs'=>'1 day', '48hrs'=>'2 days', '72hrs'=>'3 days',
'96hrs'=>'4 days', '120hrs'=>'5 days', '144hrs'=>'6 days', '168hrs'=>'7 days', '172hrs'=>'8 days', '196hrs'=>'9 days',
'220hrs'=>'10 days', '244hrs'=>'11 days', '268hrs'=>'12 days', '292hrs'=>'13 days', '316hrs'=>'14 days', '340hrs'=>'15 days'),array('empty' => 'Select Urgency Level')); ?>
<?php echo $form->error($model,'deadline'); ?> </td>
</tr>
<tr>
<td><?php echo $form->labelEx($model,'nopages'); ?></td>
<td><?php echo $form->textField($model,'nopages'); ?>
<?php echo $form->error($model,'nopages'); ?></td>
</tr>