CodeIgniter Forums
[SOLVED] form_validation textarea problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: [SOLVED] form_validation textarea problem (/showthread.php?tid=35575)



[SOLVED] form_validation textarea problem - El Forum - 11-03-2010

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


[SOLVED] form_validation textarea problem - El Forum - 11-03-2010

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

It should be:
Quote:'rules' =>

In full_name you have it correctly.


[SOLVED] form_validation textarea problem - El Forum - 11-03-2010

[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