CodeIgniter Forums
need help for form_helper - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: need help for form_helper (/showthread.php?tid=1708)



need help for form_helper - El Forum - 06-21-2007

[eluser]mr.noname[/eluser]
Hello

I'm a newbie for CI for 2 days. CI is great!

but I need help.............

How can I define rows/cols for form_textarea() by do not modify this line

Code:
$defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');

in this function

Code:
function form_textarea($data = '', $value = '', $extra = '')
{
    $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');
    
    $val = (( ! is_array($data) OR ! isset($data['value'])) ? $value : $data['value']);

    unset ($data['value']); // textareas don't use the value attribute
        
    return "<textarea ".parse_form_attributes($data, $defaults).$extra.">".$val."</textarea>\n";
}

again, I'm a newbie.
Thank you.


need help for form_helper - El Forum - 06-21-2007

[eluser]rogierb[/eluser]
try:

Code:
$textarea = array(    "name"    =>    "sometextarea",
            "rows"    =>    "10",
            "cols"    =>    "20"
         );


echo form_textarea($textarea)

But this is all documented in the user guide.
Look @ the form helper.