Codeigniter中的Combobox验证

时间:2015-05-08 05:01:06

标签: php codeigniter validation combobox

我有这个观点

echo "<td>";
    $combokategori[] =  '';
    $attribute = "id='kategori' style='width:8.5em' onchange='retrieve();'";
    echo form_dropdown('kategori', $combokategori, '', $attribute);
    echo "</td>";
    echo "<td>";
    $inputdeskripsi = array(
        'name'      => 'deskripsi',
        'id'        => 'deskripsi',
        'onkeyup'   => 'retrieve()'
    );
    echo form_input($inputdeskripsi);
echo "</td>";

并在控制器上进行验证

$this->load->library('form_validation');
$this->form_validation->set_rules('kategori', 'Kategori', 'required');
$this->form_validation->set_rules('deskripsi', 'Deskripsi', 'required');

提交一个空表单后,验证器只检测一个。并显示此错误。组合框未验证。

The Deskripsi field is required.

0 个答案:

没有答案