DB_DataObject_FormBuilder & mysql "text" type
| From: | Markus Fischer | Date: | Thu, 25 Aug 2005 13:38:33 +0000 |
| Subject: | DB_DataObject_FormBuilder & mysql "text" type | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-39555@lists.php.net to get a copy of this message | ||
Hi,
when creating a form from a DO which has columns of type "text" only a <input type="text"> is displayed instead of a textarea.
I tracked down that in FormBuilder.php in _generateForm() in the big switch statement is the case:
case ($type & DB_DATAOBJECT_STR):
Inside it only calls _createTextArea if the string contains newlines:
// If field content contains linebreaks, make textarea - otherwise, standard textbox
if (isset($this->_do->$key) && strlen($this->_do->$key) && strstr($this->_do->$key, "\n")) {
$element =& $this->_form->_createTextArea($key);
When we use this form for insert a new element, there's no value and thus there's always a TextField displayed instead of a TextArea.
The DO type is set to DB_DATAOBJECT_BLOB if it's a mysql 'text' type.
So to me it seems that the check for DB_DATAOBJECT_BLOB would be the properly solution (having the newline check is handy, too).
I've not installed the latest version (0.18.1) but downloaded and checked the source and this part seems unmodified to me.
If my analysis is correct I hope this can be fixed soon.
thanks,
- Markus