Textarea using set_value not populated Codeigniter

Nishant Jani picture Nishant Jani · Aug 16, 2012 · Viewed 16.4k times · Source

i have a simple form in my view that has a text area :

<textarea name="description" value="<?php echo   set_value('description'); ?>"></textarea>

in my controller i have validated this text area using form_validation library

$this->form_validation->set_rules('description', 'Description', 'trim|required');

the validation is working perfectly , ie it gives me the error if text area is blank , but it does not repopulate the textarea , if textarea-description is correctly filled but there is some error in the other fields

What am i doing wrong ?

Answer

Yan Berk picture Yan Berk · Aug 16, 2012

Textarea doesn't have a value attribute.

<textarea name="description"> 
      <?php echo set_value('description'); ?> 
</textarea>