Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] form_validation textarea problem
#1

[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!
#2

[eluser]cahva[/eluser]
This caught my eye:
Quote:'rule' =>

It should be:
Quote:'rules' =>

In full_name you have it correctly.
#3

[eluser]_TubbZ_[/eluser]
[quote author="cahva" date="1288828018"]This caught my eye:
Quote:'rule' =>

It should be:
Quote:'rules' =>

In full_name you have it correctly.[/quote]

ha! yeah i was doing something stupid!

I had been starring at it so long i guess i missed that!

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB