HTML_Quickform - pre-populate a textarea field
| From: | Michael Larocque | Date: | Sun, 07 May 2006 03:50:57 +0000 |
| Subject: | HTML_Quickform - pre-populate a textarea field | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23978@lists.php.net to get a copy of this message | ||
Hi all,
I've run into a problem trying to pre-populate a form. I'm pulling data out of a database and am presenting them for the user to edit.
Setting the 'value' for text inputs works fine. i.e. this works:
$attrs = array("class"=>"FCinput", "value"=>"$title");
$this->addElement('text', 'title', 'Title', $attrs);
However 'value' isn't valid for textareas. The text needs to go between the <textarea> and </textarea> tags. i.e. this _doesn't_ work:
$attrs = array("class"=>"FCtextarea", "value"=>"$shortDesc", "rows"=>"10", "cols"=>"33");
$this->addElement('textarea', 'shortDesc', 'Short Description<br />(1K max)', $attrs);
I haven't been able to figure out how to get this output:
<textarea>$shortDesc</textarea>
Any pointers welcome.
Carpe viam,
Mike
Michael Larocque
Chief Cook and Bottle Washer
Prolumina Communications Inc.
http://prolumina.com/~mlarocque/