[eluser]_TubbZ_[/eluser]
Hello,
I have started to learn CodeIgniter and all was going well, but now i have a problem which as been driving me insane for the past few hours!
My form validation method seems to be ignoring my textarea but the text box is being validated correctly. Am i doing something really stupid?
Here is my validation config:
Code:
$config = array(
'comment' => array(
array(
'field' => 'user_comment',
'label' => 'User Comment',
'rule' => 'required|min_length[5]|max_length[1000]'
),
array(
'field' => 'full_name',
'label' => 'Your name',
'rules' => 'trim|required|min_length[5]|max_length[32]|xss_clean|alpha_numeric'
)
)
);
The controller:
Code:
if ($this->form_validation->run('comment') == FALSE)
{
$data = array ( 'tutorial_id' => $this->id );
$this->load->view('comment/addcommentview',$data );
}
else
{
echo "success";
}
and here is my view:
Code:
echo validation_errors();
echo form_open("comment/post/$tutorial_id", array( 'id' => 'form_comment') );
echo form_label('Your Name: ','lbl_username');
echo form_input( array('id' => 'full_name', 'name' => 'full_name', 'maxlength' => 60, 'value' => set_value('full_name') ) );
echo "<br />" . form_label('Comment','lbl_comment');
echo form_textarea( array('id' => 'user_comment', 'name' => 'user_comment', 'style' => 'width: 100%'), set_value('user_comment') );
echo form_submit('submit_comment', 'Submit Post');
echo form_close();
Thanks!