Config文件夹/ form_validation.php中定义的规则:
'add_company_feedback_by_employee_rules' => [
[
'field' => 'company_feedback_improvement',
'label' => 'Organization feedback ',
'rules' => 'required'
],
[
'field' => 'company_feedback_suggestion',
'label' => 'Suggestion ',
'rules' => 'required'
],
[
'field' => 'company_feedback_employee',
'label' => 'Employee ID ',
'rules' => 'required|in_list[Annonymous]'
]
]
在视图中,我在下拉列表中动态显示员工ID,并且还有 一个字段Annonymous,在下拉列表中是静态的:
<?php echo form_label('Employee ID', 'company_feedback_employee'); ?>
<?php
$options = array(
'null' => 'select',
$employee_id => $employee_id,
'Annonymous' => 'Annonymous'
);
$style = array(
'class' => 'form-control',
'name' => 'company_feedback_employee',
'id' => 'company_feedback_employee'
);
echo form_dropdown('company_feedback_employee', $options,
set_value('company_feedback_employee'), $style);
echo form_error('company_feedback_employee');?>
这个in_list[Annonymous]
有问题。我怎么也不知道
我可以验证$employee_id
哪个是动态值?