Welcome Guest, Not a member yet? Register   Sign In
Help in Form Helpers using Validation Class
#4

[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();?>


Messages In This Thread
Help in Form Helpers using Validation Class - by El Forum - 07-10-2008, 10:10 PM
Help in Form Helpers using Validation Class - by El Forum - 07-11-2008, 01:20 AM
Help in Form Helpers using Validation Class - by El Forum - 07-11-2008, 01:29 AM
Help in Form Helpers using Validation Class - by El Forum - 07-11-2008, 03:10 AM
Help in Form Helpers using Validation Class - by El Forum - 07-11-2008, 05:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB