当我加载模型并从表中获取行时,我的表单验证错误不会在视图文件中显示消息。这是我的代码。
$this->form_validation->set_rules('bookCategoryId', 'Book SubCategory Id', 'trim|required');
$this->form_validation->set_rules('bookSubCategoryId', 'Book SubCategory Id', 'trim|required');
$this->form_validation->set_rules('bookSubCategoryName', 'Book SubCategory Name', 'trim|required');
if ($this->form_validation->run() == FALSE) {
/* Load Model */
$this->load->model('book_category');
/* Get Categories */
$template_data['mainContentData']['book_categories'] = $this->book_category->get_all_categories();
/* set view page to be called */
$template_data['mainContent'] = 'admin_add_book_subcategory';
/* Load Template */
$this->template($template_data);
}
如果我排除这两行,我的表格可以正常工作
/* Load Model */
$this->load->model('book_category');
/* Get Categories */
$template_data['mainContentData']['book_categories'] = $this->book_category->get_all_categories();
比我的验证显示错误。我不知道问题出在哪里?