I am trying to set a maxlength
for the form_textarea()
in Codeigniter.
I tried the following:
<?php
$options = array(
'maxlength' => '100'
);
?>
<tr>
<td><?= form_label('Profiel:');?></td>
<td><?= form_textarea('Profiel', $options, $info['Profiel']);?></td>
</tr>
When I edit my form to edit the text in the textarea it says Array. So the text is gone and is replaced with Array.
But that is not working. Maybe I have to use Jquery?
Codeigniter allows you to pass attributes into your form elements by way of an associative array.
Documentation for the form helper is here: http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html
Although I can see exactly what you're trying to do, there's one caveat with textareas. From the documentation:
So, you need to pass rows and columns instead of maxlength for textareas. Your code would look something like this: