[eluser]Civic[/eluser]
Thanks xwero for the reply. I did what you said. But I need more help. It seems I cant display my error message. below is the snippets of my code. Can you check what am I doing wrong? Thanks.
Where model index is;
$data['field_id'] = array('name'=>'field_id',
'maxlength'=>8,
'size'=>8,
'value'=>(isset($this->validation->field_id) ? $this->validation->field_id : '')
);
Where controller add is;
$rules['field_id'] = "required";
$this->validation->set_rules($rules);
if($this->input->post('save')){
if ($this->validation->run() == FALSE) {
$this->load->view('modules/addView',$data);
} else {
$this->modules_model->add();
$data['query'] = $this->modules_model->getall();
$this->load->view('modules/index',$data);
}
} else {
$this->load->view('modules/addView',$data);
}
Where add view is;
<?php
$attributes = array('name' => 'addView', 'id' => 'addView');
echo form_open('modules/add',$attributes);
?>
<?php echo form_input($field_id);?>
<?php echo $this->validation->field_id_error; ?>
<?php echo form_submit('save','Save');?>
<?php echo form_close();?>