Re: HTML_Quickform - pre-populate a textarea field
| From: | Justin Patrin | Date: | Sun, 07 May 2006 05:53:05 +0000 |
| Subject: | Re: HTML_Quickform - pre-populate a textarea field | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23979@lists.php.net to get a copy of this message | ||
On 5/6/06, Michael Larocque <mlarocque@prolumina.com> wrote:
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:Don't set the value attribute. The right way to set values for a form is $form->setDefaults(). -- Justin Patrin$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.